:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(navigation): say when a project URL is out of reach (#99800)
posthog[bot]bea0dace13d1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 66b743bb08db..d2c6db808a65 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7496,6 +7496,10 @@ snapshots:hash: v1.k794b7964.c5861b175d342db52fea2665ce0e7fb957ccc6b3b26f57f75a3ef402d021d293.hVYlxFiBOoeoyiY3YjznW61SDRRFFdtyI2GKBFAPKB8scenes-app-engineering-analytics-workflows--workflow-list-scoped-to-merge-queue--light:hash: v1.k794b7964.81034f96a01d79a233f8293715962f309d39be65d6a41683a1c18ddfd1c100f6.Wv2sRm7umnWkCm2J-G71MT5c_2yKa4sRdlzIgOqOc6M+ scenes-app-error-project-access-denied--default--dark:+ hash: v1.k794b7964.6d58f8cb9ef390270f74ef07d5104b7f42d70bb51ca35f3fdb6556bab46581ce.GP8NrKkdhrAlKBIiXl3b5ydJgg0KsSjEWj1UHG2muTo+ scenes-app-error-project-access-denied--default--light:+ hash: v1.k794b7964.ee17782476b4edf595d41079265e08ab682437c139a7121f6e66754d9df7688a.V-welVxF6fbpF4UwH8H38xQFWXaRiBBYRbQCEDD8JMMscenes-app-error-project-unavailable--access-revoked--dark:hash: v1.k794b7964.30ace8f015100159e1dedbed07ff9f0b0b770535870d5c98ea764b10ff1f7621.dTVw9qLa7D_e7ZNme4tVuPZov-0Gg1o84aiDl5zihF0scenes-app-error-project-unavailable--access-revoked--light:diff --git a/frontend/src/layout/ErrorProjectAccessDenied.stories.tsx b/frontend/src/layout/ErrorProjectAccessDenied.stories.tsxnew file mode 100644index 000000000000..3ca5d235542c--- /dev/null+++ b/frontend/src/layout/ErrorProjectAccessDenied.stories.tsx@@ -0,0 +1,17 @@+import { Meta, StoryObj } from '@storybook/react'++import { ErrorProjectAccessDenied } from './ErrorProjectAccessDenied'++const meta: Meta<typeof ErrorProjectAccessDenied> = {+ title: 'Scenes-App/Error Project Access Denied',+ component: ErrorProjectAccessDenied,+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ },+}+export default meta++type Story = StoryObj<typeof ErrorProjectAccessDenied>++export const Default: Story = {}diff --git a/frontend/src/layout/ErrorProjectAccessDenied.tsx b/frontend/src/layout/ErrorProjectAccessDenied.tsxnew file mode 100644index 000000000000..23004f184e3f--- /dev/null+++ b/frontend/src/layout/ErrorProjectAccessDenied.tsx@@ -0,0 +1,22 @@+import * as stampDenied from '@posthog/brand/hoggies/png/stamp-denied'++import { pngHoggie } from 'lib/brand/hoggies'+import { AccessDenied } from 'lib/components/AccessDenied'+import { NotFound } from 'lib/components/NotFound'+import { getAppContext } from 'lib/utils/getAppContext'++const HedgehogStampDenied = pngHoggie(stampDenied)++export function ErrorProjectAccessDenied(): JSX.Element {+ // Staff keep the impersonation shortcut, which NotFound renders from the same app context.+ if (getAppContext()?.suggested_users_with_access) {+ return <NotFound object="project" />+ }++ return (+ <AccessDenied+ reason="This link points to a project you're not a member of."+ illustration={HedgehogStampDenied}+ />+ )+}diff --git a/frontend/src/lib/components/AccessDenied/index.tsx b/frontend/src/lib/components/AccessDenied/index.tsxindex ca9c8b2bf4d5..ab469792d801 100644--- a/frontend/src/lib/components/AccessDenied/index.tsx+++ b/frontend/src/lib/components/AccessDenied/index.tsx@@ -1,5 +1,7 @@import { useActions } from 'kea'-import { ReactNode } from 'react'+import { ComponentType, ReactNode } from 'react'++import type { AssetSvgProps } from '@posthog/brand'import { Link } from 'lib/lemon-ui/Link'import { cn } from 'lib/utils/css-classes'@@ -14,22 +16,27 @@ export interface AccessDeniedProps {/** Custom explanation of *why* access is denied. Rendered in place of the default first sentence; the support-link tail stays. */reason?: ReactNodeinline?: boolean+ /** Hoggie to show above the heading, in place of the default one. */+ illustration?: ComponentType<AssetSvgProps>}-export function AccessDenied({ object, reason, inline = false }: AccessDeniedProps): JSX.Element {+export function AccessDenied({ object, reason, inline = false, illustration }: AccessDeniedProps): JSX.Element {const { openSupportForm } = useActions(supportLogic)const handleClickSupport = (): void => {openSupportForm({ kind: 'support' })}+ const Illustration = illustration+ const illustrationClassName = cn('bg-no-repeat bg-center', inline ? 'w-32 h-32' : 'w-64 h-64')+return (<div className={cn('flex flex-col items-center max-w-2xl p-4 mx-auto text-center', !inline && 'my-24')}>- <img- src={noAccessNopehog}- alt="Access denied illustration"- className={cn('bg-no-repeat bg-center', inline ? 'w-32 h-32' : 'w-64 h-64')}- />+ {Illustration ? (+ <Illustration className={illustrationClassName} />+ ) : (+ <img src={noAccessNopehog} alt="Access denied illustration" className={illustrationClassName} />+ )}<h1 className="text-3xl font-bold mt-4 mb-0">Access denied</h1>{reason ? (<>diff --git a/frontend/src/lib/utils/kea-router.ts b/frontend/src/lib/utils/kea-router.tsindex b88e3af75f7d..07a8b18ec180 100644--- a/frontend/src/lib/utils/kea-router.ts+++ b/frontend/src/lib/utils/kea-router.ts@@ -1,6 +1,6 @@import { TeamType } from '~/types'-import { getCurrentTeamId } from './getAppContext'+import { getAppContext, getCurrentTeamId } from './getAppContext'const pathsWithoutProjectId = ['api',@@ -38,6 +38,16 @@ const projectIdentifierInUrlRegex = /^\/project\/(\d+|phc_)/// and `/project/settings` out, because they have their own entries in the redirects map.const projectRootWithoutIdentifierInUrlRegex = /^\/project\/?(?=$|[?#])/+// A refused project keeps in the address whatever identifier the link carried, which can be a+// legacy project token that the pattern above does not know.+function hasProjectIdentifier(path: string): boolean {+ if (path.match(projectIdentifierInUrlRegex)) {+ return true+ }+ const refusedProject = getAppContext()?.project_access_denied+ return !!refusedProject && getProjectIdentifierInPath(path) === refusedProject+}+function isPathWithoutProjectId(path: string): boolean {const pathname = path.split(/[?#]/)[0]if (@@ -55,7 +65,7 @@ function normalizeRelativePath(path: string): string {}function addProjectIdUnlessPresent(path: string, teamId?: TeamType['id']): string {- if (path.match(projectIdentifierInUrlRegex)) {+ if (hasProjectIdentifier(path)) {return path}@@ -80,8 +90,14 @@ function addProjectIdUnlessPresent(path: string, teamId?: TeamType['id']): strinreturn `${prefix}/${path.startsWith('/') ? path.slice(1) : path}`}+/** The project id or project token a path names, exactly as it appears there. */+export function getProjectIdentifierInPath(path: string): string | null {+ const match = path.split(/[?#]/)[0].match(/^\/project\/([^/]+)(?:\/|$)/)+ return match ? match[1] : null+}+export function removeProjectIdIfPresent(path: string): string {- const withoutProjectId = path.match(projectIdentifierInUrlRegex) ? '/' + path.split('/').splice(3).join('/') : path+ const withoutProjectId = hasProjectIdentifier(path) ? '/' + path.split('/').splice(3).join('/') : pathreturn withoutProjectId.replace(projectRootWithoutIdentifierInUrlRegex, '/')}diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.tsindex cc0d1a6bedf7..88cb989cf202 100644--- a/frontend/src/scenes/appScenes.ts+++ b/frontend/src/scenes/appScenes.ts@@ -33,6 +33,9 @@ export const appScenes: Record<Scene | string, () => any> = {[Scene.DebugQuery]: () => import('./debug/DebugScene'),[Scene.Error404]: () => ({ default: preloadedScenes[Scene.Error404].component }),[Scene.ErrorNetwork]: () => ({ default: preloadedScenes[Scene.ErrorNetwork].component }),+ [Scene.ErrorProjectAccessDenied]: () => ({+ default: preloadedScenes[Scene.ErrorProjectAccessDenied].component,+ }),[Scene.ErrorProjectUnavailable]: () => ({ default: preloadedScenes[Scene.ErrorProjectUnavailable].component }),[Scene.EventDefinitionEdit]: () => import('./data-management/definition/DefinitionEdit'),[Scene.EventDefinition]: () => import('./data-management/definition/DefinitionView'),diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsxindex 21af4616a405..5a0ec60c86fe 100644--- a/frontend/src/scenes/sceneLogic.test.tsx+++ b/frontend/src/scenes/sceneLogic.test.tsx@@ -195,6 +195,31 @@ describe('sceneLogic', () => {}})+ // The third case is a legacy project token, which matches no route on its own.+ test.each(['12345', 'phc_12345', 'aBcDeFgHiJkLmN'])(+ 'renders the project access denied scene while the address names the refused project %s',+ async (refusedProject) => {+ const priorAppContext = window.POSTHOG_APP_CONTEXT+ try {+ window.POSTHOG_APP_CONTEXT = {+ ...window.POSTHOG_APP_CONTEXT,+ project_access_denied: refusedProject,+ } as AppContext++ router.actions.push(`/project/${refusedProject}/settings/user`)+ await expectLogic(logic).delay(1)+ expect(logic.values.activeSceneId).toEqual(Scene.ErrorProjectAccessDenied)++ // Later navigations run against the project we do serve.+ router.actions.push(urls.settings('user'))+ await expectLogic(logic).delay(1)+ expect(logic.values.activeSceneId).toEqual(Scene.Settings)+ } finally {+ window.POSTHOG_APP_CONTEXT = priorAppContext+ }+ }+ )+describe('/home honors the configured homepage', () => {const dashboardHomepage = {id: 'homepage-dashboard-42',diff --git a/frontend/src/scenes/sceneLogic.tsx b/frontend/src/scenes/sceneLogic.tsxindex b409afc3895f..678cbea5214f 100644--- a/frontend/src/scenes/sceneLogic.tsx+++ b/frontend/src/scenes/sceneLogic.tsx@@ -24,7 +24,12 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'import { Spinner } from 'lib/lemon-ui/Spinner'import { getAppContext } from 'lib/utils/getAppContext'import { isChunkLoadError } from 'lib/utils/isChunkLoadError'-import { addProjectIdIfMissing, removeProjectIdIfPresent, stripTrailingSlash } from 'lib/utils/kea-router'+import {+ addProjectIdIfMissing,+ getProjectIdentifierInPath,+ removeProjectIdIfPresent,+ stripTrailingSlash,+} from 'lib/utils/kea-router'import { retryImport } from 'lib/utils/retryImport'import { identifierToHuman } from 'lib/utils/strings'import { getRelativeNextPath } from 'lib/utils/url'@@ -340,7 +345,15 @@ export interface sceneLogicProps {export interface sceneLogicMeta {__keaTypeGenInternalSelectorTypes: {sceneConfig: (sceneId: string | null) => SceneConfig | null- activeSceneId: (sceneId: string | null, isCurrentTeamUnavailable: boolean) => string | null+ activeSceneId: (+ sceneId: string | null,+ isCurrentTeamUnavailable: boolean,+ location: {+ hash: string+ pathname: string+ search: string+ }+ ) => string | nullactiveExportedScene: (activeSceneId: string | null,exportedScenes: Record<string, SceneExport<SceneProps>>@@ -509,9 +522,22 @@ export const sceneLogic = kea<sceneLogicType>([{ resultEqualityCheck: equal },],activeSceneId: [- (s) => [s.sceneId, teamLogic.selectors.isCurrentTeamUnavailable],- (sceneId: string | null, isCurrentTeamUnavailable: boolean) => {- const effectiveResourceAccessControl = getAppContext()?.effective_resource_access_control+ (s) => [s.sceneId, teamLogic.selectors.isCurrentTeamUnavailable, router.selectors.location],+ (sceneId: string | null, isCurrentTeamUnavailable: boolean, location: { pathname: string }) => {+ const appContext = getAppContext()+ const effectiveResourceAccessControl = appContext?.effective_resource_access_control++ // The server refused the project this address names and served the user's own one,+ // so the page cannot load. Once the address bar names a project we do serve, the+ // scene loads as usual.+ if (+ appContext?.project_access_denied &&+ sceneId &&+ sceneConfigurations[sceneId]?.projectBased &&+ getProjectIdentifierInPath(location.pathname) === appContext.project_access_denied+ ) {+ return Scene.ErrorProjectAccessDenied+ }// Get the access control resource type for the current sceneconst sceneAccessControlResource = sceneId ? sceneToAccessControlResourceType[sceneId as Scene] : nulldiff --git a/frontend/src/scenes/sceneSmoke.test.tsx b/frontend/src/scenes/sceneSmoke.test.tsxindex 3c5ad26fffd0..3d1df93b0bf3 100644--- a/frontend/src/scenes/sceneSmoke.test.tsx+++ b/frontend/src/scenes/sceneSmoke.test.tsx@@ -39,6 +39,7 @@ const ERROR_SCENES: string[] = [Scene.Error404,Scene.ErrorNetwork,Scene.ErrorProjectUnavailable,+ Scene.ErrorProjectAccessDenied,Scene.ErrorAccessDenied,]diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex 07be0b0a6557..5a98a1bcd642 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -54,6 +54,7 @@ export enum Scene {Error404 = '404',ErrorAccessDenied = 'AccessDenied',ErrorNetwork = '4xx',+ ErrorProjectAccessDenied = 'ProjectAccessDenied',ErrorProjectUnavailable = 'ProjectUnavailable',ErrorTracking = 'ErrorTracking',ErrorTrackingFingerprint = 'ErrorTrackingFingerprint',diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.tsindex 985a816a6a83..ca167a428e35 100644--- a/frontend/src/scenes/scenes.ts+++ b/frontend/src/scenes/scenes.ts@@ -10,6 +10,7 @@ import { urls } from 'scenes/urls'import { Error404 as Error404Component } from '~/layout/Error404'import { ErrorAccessDenied as ErrorAccessDeniedComponent } from '~/layout/ErrorAccessDenied'import { ErrorNetwork as ErrorNetworkComponent } from '~/layout/ErrorNetwork'+import { ErrorProjectAccessDenied as ErrorProjectAccessDeniedComponent } from '~/layout/ErrorProjectAccessDenied'import { ErrorProjectUnavailable as ErrorProjectUnavailableComponent } from '~/layout/ErrorProjectUnavailable'import { productConfiguration, productRedirects, productRoutes } from '~/products'import { EventsQuery } from '~/queries/schema/schema-general'@@ -29,6 +30,9 @@ export const preloadedScenes: Record<string, SceneExport> = {[Scene.ErrorNetwork]: {component: ErrorNetworkComponent,},+ [Scene.ErrorProjectAccessDenied]: {+ component: ErrorProjectAccessDeniedComponent,+ },[Scene.ErrorProjectUnavailable]: {component: ErrorProjectUnavailableComponent,},@@ -151,6 +155,7 @@ export const sceneConfigurations: Record<Scene | string, SceneConfig> = {[Scene.Error404]: { name: 'Not found', projectBased: true },[Scene.ErrorAccessDenied]: { name: 'Access denied' },[Scene.ErrorNetwork]: { name: 'Network error' },+ [Scene.ErrorProjectAccessDenied]: { name: 'Project access denied' },[Scene.ErrorProjectUnavailable]: { name: 'Project unavailable' },[Scene.EventDefinitionEdit]: {projectBased: true,diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 9950ce591850..baceff1764ee 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -5217,6 +5217,8 @@ export interface AppContext {switched_team: TeamType['id'] | null/** Support flow aid: a staff-only list of users who may be impersonated to access this resource. */suggested_users_with_access?: UserBasicType[]+ /** The project the URL asked for, as an id or a token, when the server refused to switch to it. */+ project_access_denied?: string | nulllivestream_host?: stringoauth_application?: OAuthApplicationPublicMetadata/** Server-resolved MCP scopes for OAuth consent when the client omits `scope`. */diff --git a/posthog/middleware.py b/posthog/middleware.pyindex ec7eb6e6a146..0a465dace051 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -249,26 +249,18 @@ class AutoProjectMiddleware:and path_parts[0] == "project"and (path_parts[1].startswith("phc_") or path_parts[1] in self.token_allowlist)):+ new_team = Team.objects.filter(api_token=path_parts[1]).first()- def do_redirect():+ if new_team is not None and self.switch_team_if_allowed(new_team, request):+ path_parts[1] = str(new_team.pk)new_path = "/".join(path_parts)search_params = request.GET.urlencode()-return redirect(f"/{new_path}?{search_params}" if search_params else f"/{new_path}")- try:- new_team = Team.objects.get(api_token=path_parts[1])-- if not self.can_switch_to_team(new_team, request):- raise Team.DoesNotExist-- path_parts[1] = str(new_team.pk)- return do_redirect()-- except Team.DoesNotExist:- if user.team:- path_parts[1] = str(user.team.pk)- return do_redirect()+ # The token names no project the person can open. The address keeps the token,+ # which tells them nothing about the project behind it.+ if user.team:+ request.project_access_denied = path_parts[1] # type: ignoreif len(path_parts) >= 2 and path_parts[0] == "project" and path_parts[1].isdigit():project_id_in_url = int(path_parts[1])@@ -282,11 +274,16 @@ class AutoProjectMiddleware:project_id_in_url = int(path_parts[2])if project_id_in_url and user.team and user.team.pk != project_id_in_url:+ switched = Falsetry:new_team = Team.objects.get(pk=project_id_in_url)- self.switch_team_if_allowed(new_team, request)+ switched = self.switch_team_if_allowed(new_team, request)except Team.DoesNotExist:pass+ if not switched and path_parts[0] == "project":+ # We keep serving the user's own team here, so the app must say so instead of+ # rendering that team under another project's address.+ request.project_access_denied = path_parts[1] # type: ignorereturn self.get_response(request)target_queryset = self.get_target_queryset(request)@@ -336,11 +333,11 @@ class AutoProjectMiddleware:if actual_item is not None:self.switch_team_if_allowed(actual_item.team, request)- def switch_team_if_allowed(self, new_team: Team, request: HttpRequest):+ def switch_team_if_allowed(self, new_team: Team, request: HttpRequest) -> bool:user = cast(User, request.user)if not self.can_switch_to_team(new_team, request):- return+ return Falseold_team_id = user.current_team_iduser.team = new_team@@ -349,6 +346,7 @@ class AutoProjectMiddleware:user.save()# Information for POSTHOG_APP_CONTEXTrequest.switched_team = old_team_id # type: ignore+ return Truedef can_switch_to_team(self, new_team: Team, request: HttpRequest):user = cast(User, request.user)diff --git a/posthog/test/test_middleware.py b/posthog/test/test_middleware.pyindex b1838a41279b..7b1653f9ceff 100644--- a/posthog/test/test_middleware.py+++ b/posthog/test/test_middleware.py@@ -225,6 +225,9 @@ class TestAutoProjectMiddleware(APIBaseTest):self.user.current_team = self.teamself.user.current_organization = self.organization+ def app_context(self, response) -> dict:+ return json.loads(response.context["posthog_app_context"])+@override_settings(PERSON_ON_EVENTS_V2_OVERRIDE=False)def test_project_switched_when_accessing_dashboard_of_another_accessible_team(self):dashboard = Dashboard.objects.create(team=self.second_team)@@ -401,11 +404,13 @@ class TestAutoProjectMiddleware(APIBaseTest):response_users_api = self.client.get(f"/api/users/@me/")assert project_1_request.status_code == 200assert response_users_api.json().get("team", {}).get("id") == self.team.id+ assert self.app_context(project_1_request)["project_access_denied"] is Noneproject_2_request = self.client.get(f"/project/{self.no_access_team.pk}/home")response_users_api = self.client.get(f"/api/users/@me/")assert project_2_request.status_code == 200assert response_users_api.json().get("team", {}).get("id") == self.team.id+ assert self.app_context(project_2_request)["project_access_denied"] == str(self.no_access_team.pk)def test_project_unchanged_when_accessing_missing_project_by_id(self):project_1_request = self.client.get(f"/project/{self.team.pk}/home")@@ -417,6 +422,7 @@ class TestAutoProjectMiddleware(APIBaseTest):response_users_api = self.client.get(f"/api/users/@me/")assert project_2_request.status_code == 200assert response_users_api.json().get("team", {}).get("id") == self.team.id+ assert self.app_context(project_2_request)["project_access_denied"] == "999999"def test_project_redirects_to_new_team_when_accessing_project_by_token(self):res = self.client.get(f"/project/{self.second_team.api_token}/home")@@ -433,28 +439,24 @@ class TestAutoProjectMiddleware(APIBaseTest):== f"/project/{self.third_team.pk}/replay/018f5c3e-1a17-7f2b-ac83-32d06be3269b?t=2601")- def test_project_redirects_to_current_team_when_accessing_missing_project_by_token(- self,- ):- res = self.client.get(f"/project/phc_123/home")- assert res.status_code == 302- assert res.headers["Location"] == f"/project/{self.team.pk}/home"+ @parameterized.expand([("missing", None), ("inaccessible", "no_access_team")])+ def test_project_access_denied_when_accessing_unreachable_project_by_token(self, _name, team_attribute):+ token = getattr(self, team_attribute).api_token if team_attribute else "phc_123"- def test_project_redirects_to_current_team_when_accessing_inaccessible_project_by_token(- self,- ):- res = self.client.get(f"/project/{self.no_access_team.api_token}/home")- assert res.status_code == 302- assert res.headers["Location"] == f"/project/{self.team.pk}/home"+ res = self.client.get(f"/project/{token}/home")+ assert res.status_code == 200+ response_users_api = self.client.get(f"/api/users/@me/")+ assert response_users_api.json().get("team", {}).get("id") == self.team.id+ assert self.app_context(res)["project_access_denied"] == tokendef test_project_redirects_including_query_params(self):- res = self.client.get(f"/project/phc_123?t=1")+ res = self.client.get(f"/project/{self.second_team.api_token}?t=1")assert res.status_code == 302- assert res.headers["Location"] == f"/project/{self.team.pk}?t=1"+ assert res.headers["Location"] == f"/project/{self.second_team.pk}?t=1"- res = self.client.get(f"/project/phc_123/home?t=1")+ res = self.client.get(f"/project/{self.second_team.api_token}/home?t=1")assert res.status_code == 302- assert res.headers["Location"] == f"/project/{self.team.pk}/home?t=1"+ assert res.headers["Location"] == f"/project/{self.second_team.pk}/home?t=1"@override_settings(CLOUD_DEPLOYMENT="US") # As PostHog Clouddiff --git a/posthog/utils.py b/posthog/utils.pyindex cd74b7ef8c9d..784d51b3dc78 100644--- a/posthog/utils.py+++ b/posthog/utils.py@@ -606,6 +606,7 @@ def _build_template_context("custom_products": [],"switched_team": getattr(request, "switched_team", None),"suggested_users_with_access": getattr(request, "suggested_users_with_access", None),+ "project_access_denied": getattr(request, "project_access_denied", None),"commit_sha": context["git_rev"],"livestream_host": settings.LIVESTREAM_HOST,**posthog_app_context,