Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] Codex bridge permission mirror crashes on bracketed shell operands and fails…

Open IvanLeontev-stack opened this issue 1 week ago • 1 comments

What happened

Codex bridge permission mirror crashes on bracketed shell operands and fails open, so deny rules are skipped

Summary

Component: Codex front door, LIFEOS/CODEX/Bridge.ts (permission mirror)

What happens: segRegex() turns a [...] in a shell operand into a regex character class without validating it. When the bracket text holds a reversed range, new RegExp throws SyntaxError: Invalid regular expression: range out of order in character class. The throw is not caught inside permissionMirror, so the whole PreToolUse call fails, the bridge returns {} (fail open, Bridge.ts:926-929), and Codex runs the command with no deny/ask check and no PreToolUse hooks.

Repro (current main, segRegex at line 584): any Bash command with an operand like '[.comments[-4:][]|{body,url}]' (a common gh --jq filter). Inside the class, [-4 is a range from [ (0x5B) down to 4 (0x34). Standalone:

segRegex("[.comments[-4:][]|{body,url}]")  // throws: range out of order

Observed: 33 such fail-open calls in one install's bridge event log over two weeks ("hooks":[], "fanout":0, fault range out of order). None was harmful in our case; but a deny rule (e.g. reading .env) would not have fired on any of them.

Why it matters: CodexFrontDoor.md:138 says the bridge fails open on adapter faults but closed on decisions. Here the decision path itself crashes, so a decision silently becomes an allow. In Claude Code the same rules are enforced natively and cannot drop out this way.

Suggested fix: wrap the new RegExp in segRegex in try/catch and fall back to a literal (escaped) match, the way pathTokens already does (try { ... } catch { /* fall through as literal */ }); optionally make an unexpected throw inside permissionMirror fail closed (ask) rather than open.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

IvanLeontev-stack avatar Nov 22 '26 21:11 IvanLeontev-stack

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks for the report. This is fixed in our tree today (41b5f8887b), and you're credited at the fix site and as a co-author on the commit. It ships in the next public release. Closing.

danielmiessler avatar Dec 01 '26 10:12 danielmiessler