diff --git a/src/gateway/node-command-policy.ts b/src/gateway/node-command-policy.ts index 7310dc4ec73..7c5fcbe8d0d 100644 --- a/src/gateway/node-command-policy.ts +++ b/src/gateway/node-command-policy.ts @@ -203,8 +203,9 @@ export function isNodeCommandAllowed(params: { if (!params.allowlist.has(command)) { return { ok: false, reason: "command not allowlisted" }; } - if (Array.isArray(params.declaredCommands) && params.declaredCommands.length > 0) { - if (!params.declaredCommands.includes(command)) { + const { declaredCommands } = params; + if (Array.isArray(declaredCommands) && declaredCommands.length > 0) { + if (!declaredCommands.includes(command)) { return { ok: false, reason: "command not declared by node" }; } } else { diff --git a/src/gateway/server-methods/nodes.ts b/src/gateway/server-methods/nodes.ts index ae6c8090b6c..3fb0ddc7653 100644 --- a/src/gateway/server-methods/nodes.ts +++ b/src/gateway/server-methods/nodes.ts @@ -1003,15 +1003,16 @@ export const nodeHandlers: GatewayRequestHandlers = { `node wake done node=${nodeId} req=${wakeReqId} connected=true totalMs=${totalDurationMs}`, ); } + const session = nodeSession; const cfg = loadConfig(); - const allowlist = resolveNodeCommandAllowlist(cfg, nodeSession); + const allowlist = resolveNodeCommandAllowlist(cfg, session); const allowed = isNodeCommandAllowed({ command, - declaredCommands: nodeSession.commands, + declaredCommands: session.commands, allowlist, }); if (!allowed.ok) { - const hint = buildNodeCommandRejectionHint(allowed.reason, command, nodeSession); + const hint = buildNodeCommandRejectionHint(allowed.reason, command, session); respond( false, undefined, diff --git a/src/infra/net/undici-global-dispatcher.ts b/src/infra/net/undici-global-dispatcher.ts index 4874a8614a6..753e7e5281e 100644 --- a/src/infra/net/undici-global-dispatcher.ts +++ b/src/infra/net/undici-global-dispatcher.ts @@ -123,7 +123,7 @@ export function ensureGlobalUndiciStreamTimeouts(opts?: { timeoutMs?: number }): const connect = resolveConnectOptions(autoSelectFamily); try { if (kind === "env-proxy") { - const proxyConnect = { keepAlive: false, ...connect }; + const proxyConnect = { ...connect, keepAlive: false }; const proxyOptions = { bodyTimeout: timeoutMs, headersTimeout: timeoutMs,