Skip to content

Commit 5153300

Browse files
afrojunclaudemaria-rcks
authored
fix(desktop): browser tabs no longer report loopback access as denied (#22835)
Co-authored-by: afrojun <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent 159a914 commit 5153300

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe("BrowserSession", () => {
145145
}).pipe(Effect.provide(layer)),
146146
);
147147

148-
it.effect("grants clipboard-sanitized-write through both the request and check handlers", () =>
148+
it.effect("grants preview permissions through both the request and check handlers", () =>
149149
Effect.gen(function* () {
150150
const browserSessions = yield* BrowserSession.BrowserSession;
151151
const partition = yield* browserSessions.getPartition("scope-a");
@@ -168,7 +168,12 @@ describe("BrowserSession", () => {
168168
return granted;
169169
};
170170

171-
for (const permission of ["clipboard-sanitized-write", "geolocation", "fullscreen"]) {
171+
for (const permission of [
172+
"clipboard-sanitized-write",
173+
"geolocation",
174+
"fullscreen",
175+
"loopback-network",
176+
]) {
172177
assert.isTrue(requestAllows(permission), `request handler should allow ${permission}`);
173178
assert.isTrue(
174179
checkHandler(null, permission) as boolean,
@@ -179,7 +184,13 @@ describe("BrowserSession", () => {
179184
// `clipboard-write` is not a real Electron permission — the async write API
180185
// uses `clipboard-sanitized-write` — so the stale name must not be granted,
181186
// and unrelated permissions stay denied.
182-
for (const permission of ["clipboard-write", "notifications", "midi"]) {
187+
for (const permission of [
188+
"clipboard-write",
189+
"notifications",
190+
"midi",
191+
"local-network",
192+
"local-network-access",
193+
]) {
183194
assert.isFalse(requestAllows(permission), `request handler should deny ${permission}`);
184195
assert.isFalse(
185196
checkHandler(null, permission) as boolean,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set([
2424
"geolocation",
2525
// DesktopWindow confines HTML fullscreen to the guest's webview.
2626
"fullscreen",
27+
// Loopback requests already succeed in Electron 44; permission-aware sign-in widgets query first.
28+
"loopback-network",
2729
// Deny local-fonts to untrusted previews: it exposes installed-font fingerprints and file bytes.
2830
// Deny notifications: pages could impersonate T3 Code; app notifications use the default session.
2931
]);

0 commit comments

Comments
 (0)