A desktop coding agent with free access to frontier models.
TypeScript
fix: refuse token-shaped key flag values
ogsamrat147fb40ef5af
diff --git a/apps/server/src/mcp-allow/PARITY.sha256 b/apps/server/src/mcp-allow/PARITY.sha256index aeab23b3..a397ebc2 100644--- a/apps/server/src/mcp-allow/PARITY.sha256+++ b/apps/server/src/mcp-allow/PARITY.sha256@@ -1,4 +1,4 @@# The MCP allowlist module: the same files in omnirush-cli (src/mcp/) and omnirush-gui (apps/server/src/mcp-allow/).# A change to one must be ported to the other and this list updated in both.-42879c5c348f59c70af4f85aeba02526557ad6a66290196c0175a646908aea8a mcp-allow.mjs+382deaf703ca07b9c83444311b24e642599c49e840780fd09d9cefaf222257f6 mcp-allow.mjs482fb25ea7dba6dc91aeeb24891e0b2e94d4abe8ff585b0068eb2a7575e75491 mcp-allow.d.mtsdiff --git a/apps/server/src/mcp-allow/mcp-allow.mjs b/apps/server/src/mcp-allow/mcp-allow.mjsindex ab49ada0..42c60c7d 100644--- a/apps/server/src/mcp-allow/mcp-allow.mjs+++ b/apps/server/src/mcp-allow/mcp-allow.mjs@@ -169,6 +169,8 @@ function normalizeRules(value) {// The same check as the backend's mcp_policy.remote_url (test/fixtures/mcp-remote-urls.json, both sides): plain// host names only (no escapes, IP shortcuts or trailing dot), a port without leading zeros, a path without// escapes or dot segments, no user, query or fragment.+// Token shapes a key server's arguments must not hold (Figma's personal and OAuth tokens).+const TOKEN_SHAPE = /(?:^|[^A-Za-z0-9_])fig(?:d|u|ur)_[A-Za-z0-9_-]{20,}/;const REMOTE_URL = /^(https?):\/\/((?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*|\[::1\])(?::([1-9][0-9]{0,4}))?(\/[A-Za-z0-9._~/-]*)?$/i;export function normalizeRemoteUrl(value) {@@ -586,7 +588,9 @@ export function evaluateMcp(mcpMap, policy, ctx = {}) {// the process list). A path flag's value is the one argument allowed.for (let i = 0; i < rest.length; i += 1) {const arg = String(rest[i]);- if (arg.startsWith("-")) { if (!arg.includes("=") && (rules.path_flags ?? []).includes(arg)) i += 1; continue; }+ // A path flag's value that looks like a token is refused too (a key typed in the wrong place).+ const value = arg.startsWith("-") ? (arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : !arg.includes("=") && (rules.path_flags ?? []).includes(arg) ? String(rest[i + 1] ?? "") : "") : null;+ if (value !== null && !TOKEN_SHAPE.test(value)) { if (!arg.includes("=") && (rules.path_flags ?? []).includes(arg)) i += 1; continue; }refusal = blocked(name, "flag", { ...base, version, reason: MCP_REASONS.secret_flag });break;}