Skip to content

Commit c3fd3f5

Browse files
committed
fix(node-pairing): require operator.admin to approve browser.proxy nodes
Approving a node whose pairing surface advertises browser.proxy only required operator.write, while invoking browser.proxy already requires operator.admin (server-methods/nodes.ts). resolveNodePairApprovalScopes bumped the approval scope to operator.admin only for NODE_SYSTEM_RUN_COMMANDS, so a write-scoped operator could trust a browser.proxy-capable node that later routes bundled browser-tool traffic. Add NODE_BROWSER_PROXY_COMMAND to the admin-approval set so approval scope matches the invoke-time gate.
1 parent e681646 commit c3fd3f5

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎src/infra/node-pairing-authz.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ describe("resolveNodePairApprovalScopes", () => {
1010
]);
1111
});
1212

13+
it("requires operator.admin for browser.proxy commands", () => {
14+
expect(resolveNodePairApprovalScopes(["browser.proxy"])).toEqual([
15+
"operator.pairing",
16+
"operator.admin",
17+
]);
18+
});
19+
1320
it("requires operator.write for non-exec commands", () => {
1421
expect(resolveNodePairApprovalScopes(["canvas.present"])).toEqual([
1522
"operator.pairing",

‎src/infra/node-pairing-authz.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Maps node pairing command declarations to required operator scopes.
2-
import { NODE_SYSTEM_RUN_COMMANDS } from "./node-commands.js";
2+
import { NODE_BROWSER_PROXY_COMMAND, NODE_SYSTEM_RUN_COMMANDS } from "./node-commands.js";
33

44
/** Operator scopes required to approve a pending node pairing surface. */
55
export type NodeApprovalScope = "operator.pairing" | "operator.write" | "operator.admin";
@@ -8,13 +8,15 @@ const OPERATOR_PAIRING_SCOPE: NodeApprovalScope = "operator.pairing";
88
const OPERATOR_WRITE_SCOPE: NodeApprovalScope = "operator.write";
99
const OPERATOR_ADMIN_SCOPE: NodeApprovalScope = "operator.admin";
1010

11+
const ADMIN_APPROVAL_COMMANDS = [...NODE_SYSTEM_RUN_COMMANDS, NODE_BROWSER_PROXY_COMMAND];
12+
1113
/** Map declared node commands to the least operator scopes needed for approval. */
1214
export function resolveNodePairApprovalScopes(commands: unknown): NodeApprovalScope[] {
1315
const normalized = Array.isArray(commands)
1416
? commands.filter((command): command is string => typeof command === "string")
1517
: [];
1618
if (
17-
normalized.some((command) => NODE_SYSTEM_RUN_COMMANDS.some((allowed) => allowed === command))
19+
normalized.some((command) => ADMIN_APPROVAL_COMMANDS.some((allowed) => allowed === command))
1820
) {
1921
return [OPERATOR_PAIRING_SCOPE, OPERATOR_ADMIN_SCOPE];
2022
}

0 commit comments

Comments
 (0)