Skip to content

Commit 05773a1

Browse files
committed
fix(desktop): built-in browser sites can no longer post notifications without permission
Every preview partition granted the "notifications" permission to any site through both the permission request and check handlers, so a visited page could call Notification.requestPermission(), get "granted" with no prompt, and raise native OS notifications branded as T3 Code. Drop "notifications" from the preview allowlist so those sessions deny it like any other unlisted permission. T3's own thread notifications are created by the app window, which uses Electron's default session rather than a preview partition, so they are unaffected. Fixes #20218
1 parent cfafb4b commit 05773a1

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/desktop/src/preview/BrowserSession.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ describe("BrowserSession", () => {
180180
for (const permission of [
181181
"clipboard-read",
182182
"clipboard-sanitized-write",
183-
"notifications",
184183
"geolocation",
185184
"fullscreen",
186185
]) {
@@ -193,8 +192,9 @@ describe("BrowserSession", () => {
193192

194193
// `clipboard-write` is not a real Electron permission — the async write API
195194
// uses `clipboard-sanitized-write` — so the stale name must not be granted,
196-
// and unrelated permissions stay denied.
197-
for (const permission of ["clipboard-write", "midi"]) {
195+
// and unrelated permissions stay denied. Sites must not be able to post
196+
// notifications as T3 Code.
197+
for (const permission of ["clipboard-write", "notifications", "midi"]) {
198198
assert.isFalse(requestAllows(permission), `request handler should deny ${permission}`);
199199
assert.isFalse(
200200
checkHandler(null, permission) as boolean,

‎apps/desktop/src/preview/BrowserSession.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export type BrowserSessionPartitionNamespace = "profile";
3333
const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set([
3434
"clipboard-read",
3535
"clipboard-sanitized-write",
36-
"notifications",
3736
"geolocation",
3837
// `DesktopWindow` disables HTML fullscreen window resizing for the app window
3938
// and every preview guest, so a page that goes fullscreen fills its own
@@ -42,6 +41,9 @@ const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set([
4241
// Deliberately NOT local-fonts: preview sessions run untrusted web content,
4342
// and silently granting it would hand every page the user's installed-font
4443
// fingerprint (and font file bytes via FontData.blob()).
44+
// Deliberately NOT notifications: granting it would let any page raise native
45+
// OS notifications branded as T3 Code. T3's own notifications come from the
46+
// app window's default session, not these partitions.
4547
]);
4648

4749
const NEVER_EXTERNAL_PROTOCOLS: ReadonlySet<string> = new Set([

0 commit comments

Comments
 (0)