TypeScript
fix(desktop): built-in browser sites can no longer post notifications without permission (#20237)
fixfon30448e37e983
diff --git a/apps/desktop/src/preview/BrowserSession.test.ts b/apps/desktop/src/preview/BrowserSession.test.tsindex fc4c2dfc843..d421898732a 100644--- a/apps/desktop/src/preview/BrowserSession.test.ts+++ b/apps/desktop/src/preview/BrowserSession.test.ts@@ -180,7 +180,6 @@ describe("BrowserSession", () => {for (const permission of ["clipboard-read","clipboard-sanitized-write",- "notifications","geolocation","fullscreen",]) {@@ -194,7 +193,7 @@ describe("BrowserSession", () => {// `clipboard-write` is not a real Electron permission — the async write API// uses `clipboard-sanitized-write` — so the stale name must not be granted,// and unrelated permissions stay denied.- for (const permission of ["clipboard-write", "midi"]) {+ for (const permission of ["clipboard-write", "notifications", "midi"]) {assert.isFalse(requestAllows(permission), `request handler should deny ${permission}`);assert.isFalse(checkHandler(null, permission) as boolean,diff --git a/apps/desktop/src/preview/BrowserSession.ts b/apps/desktop/src/preview/BrowserSession.tsindex 9f0b5edb109..3847ec33233 100644--- a/apps/desktop/src/preview/BrowserSession.ts+++ b/apps/desktop/src/preview/BrowserSession.ts@@ -33,7 +33,6 @@ export type BrowserSessionPartitionNamespace = "profile";const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set(["clipboard-read","clipboard-sanitized-write",- "notifications","geolocation",// `DesktopWindow` disables HTML fullscreen window resizing for the app window// and every preview guest, so a page that goes fullscreen fills its own@@ -42,6 +41,8 @@ const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set([// Deliberately NOT local-fonts: preview sessions run untrusted web content,// and silently granting it would hand every page the user's installed-font// fingerprint (and font file bytes via FontData.blob()).+ // Deliberately NOT notifications: a page could post OS notifications branded+ // as T3 Code. T3's own come from the app window on the default session.]);const NEVER_EXTERNAL_PROTOCOLS: ReadonlySet<string> = new Set([