Skip to content

Commit 1a8d9d5

Browse files
authored
fix(browser): allow host-local profile administration (#104616)
1 parent 7193d29 commit 1a8d9d5

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

‎extensions/browser/src/gateway/browser-request.profile-from-body.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe("browser.request profile selection", () => {
248248
{ method: "DELETE", path: "/profiles/poc", body: undefined },
249249
{ method: "POST", path: "/reset-profile", body: { profile: "poc", name: "poc" } },
250250
])(
251-
"blocks host-local persistent mutations for $method $path when no node handles the request",
251+
"dispatches host-local admin mutations for $method $path when no node handles the request",
252252
async ({ method, path, body }) => {
253253
const { respond, nodeRegistry } = await runBrowserRequest(
254254
{ method, path, body },
@@ -257,10 +257,11 @@ describe("browser.request profile selection", () => {
257257
);
258258

259259
expect(nodeRegistry.invoke).not.toHaveBeenCalled();
260+
expect(startBrowserControlServiceFromConfigMock).toHaveBeenCalledOnce();
260261
const [ok, payload, error] = firstRespondCall(respond);
261262
expect(ok).toBe(false);
262263
expect(payload).toBeUndefined();
263-
expect(error?.message).toBe("browser.request cannot mutate persistent browser profiles");
264+
expect(error?.message).toBe("browser control is disabled");
264265
},
265266
);
266267

‎extensions/browser/src/gateway/browser-request.ts‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
errorShape,
2121
getRuntimeConfig,
2222
isBrowserHostLocalRoute,
23-
isBrowserSystemProfileImport,
2423
isNodeCommandAllowed,
2524
isPersistentBrowserProfileMutation,
2625
persistBrowserProxyFiles,
@@ -217,24 +216,9 @@ export async function handleBrowserGatewayRequest({
217216
return;
218217
}
219218

220-
// Host-local dispatch: persistent profile mutations stay blocked here as on a
221-
// node proxy, except system-profile import, which must run where the user's
222-
// Keychain lives and cannot be proxied to a node.
223-
if (
224-
isPersistentBrowserProfileMutation(methodRaw, path) &&
225-
!isBrowserSystemProfileImport(methodRaw, path)
226-
) {
227-
respond(
228-
false,
229-
undefined,
230-
errorShape(
231-
ErrorCodes.INVALID_REQUEST,
232-
"browser.request cannot mutate persistent browser profiles",
233-
),
234-
);
235-
return;
236-
}
237-
219+
// `browser.request` already requires operator.admin. The owning host may run
220+
// profile administration; the node-proxy branch above stays denied because
221+
// `browser.proxy` is a separate remote-host authority.
238222
const ready = await startBrowserControlServiceFromConfig();
239223
if (!ready) {
240224
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, "browser control is disabled"));

0 commit comments

Comments
 (0)