Skip to content

🤖 fix: redact what the shell joins onto a quoted cookie header - #8244

Merged
ThomasK33 merged 1 commit into
mainfrom
oracles-cookie-shell-word
Dec 5, 2026
Merged

ThomasK33 merged 1 commit into
mainfrom
oracles-cookie-shell-word

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Memory redaction now treats a cookie header in a shell argument (curl -H "Cookie: ...") as running to the end of its shell word. A word or a quoted segment glued behind the header's closing quote is part of the same argument, so it is redacted too. Examples are -H "Cookie: sid=a",tok=VALUE and -H "Cookie: sid=a","tok=VALUE". Before this change, that glued value reached the memory harvest in clear text.

Background

Codex raised this on #8228 (finding 13). We deferred it to this follow-up, with the rule chosen on that PR (Option B): a shell argument's value ends where its shell word ends, while a header string in JSON or a list keeps the item after it.

Implementation

All changes are in src/node/services/memorySecretRedaction.ts:

  • A quote opens a shell argument when blanks behind a word come right before it (-H ", echo '). Behind [, {, ,, : or = it still opens a JSON or list item, whose closing quote ends the value. So ["Cookie: a","Accept: */*"] keeps "Accept: */*".
  • After a shell argument's closing quote, shellValueEnd extends the value through the glued shell word (readShellWord). It does this only when a ,, ], } or : comes right after the close and the glued text holds a letter or digit. Punctuation alone ("Cookie: sid=x", then ... in prose) holds no value, so the close stays.
  • The shell word reads a quoted segment whole and goes on after it. It takes \' as a literal quote, not a segment. It ends at a blank, a tab, an operator, a backtick or the end of its line. In an escaped command (a JSON string that holds the command line), it also ends at an escaped line break or at the close of that JSON string. A ' is content there: it opens a segment and does not close the string.
  • A quoted segment that never closes ends at the end of its line, as the header's value does, so it cannot take the lines after it.

Validation

  • Oracle tests/oracles/memorySecretRedaction.oracle.ts:
    • 14 new shapes. Ten shell forms must go, among them a quoted segment, a single-quoted segment, \', a tab, an unclosed segment, the end of a line and a command in a JSON string. A prose comma behind the close must stay, two JSON header lists must keep their next item, and a JSON cookie key at the end of its line must keep its closing quote.
    • A new ordinary line holds a header name with no :.
    • Three constructed histories write the shell forms raw and JSON-escaped once and twice, so the fixed seed reaches every one.
    • The law and authority text name the shell argument.
    • Result: RED on main (33 of 206 tests fail), GREEN here (206 pass).
  • Gap check (make test-oracles): 96 gaps, all already open on main (103 gaps there; this branch closes 7 of them). Every mutant in the new functions is killed. While closing those gaps, the oracle found a second leak, now fixed: in a JSON-escaped command, a ' after the header's close was read as the close of the JSON string, so ,'x VALUE' stayed readable.
  • Unit tests: memorySecretRedaction.test.ts covers the shell forms raw and JSON-escaped, the unclosed segment, the JSON items that stay, and the guards. memoryToolText.test.ts adds the Codex repro: renderToolValue of a tool result whose stdout holds the curl line, raw or JSON-escaped. It fails on main and passes here. The memoryService and memoryConsolidation tests pass.
  • make static-check passes except lint-hadolint, which is not installed on this host; this PR changes no Dockerfile. ESLint, make crap-check and make dry-check pass.

Risks

  • A shell argument can now lose more text than before: everything glued behind its closing quote, up to the end of the shell word. This happens only when the quote follows blanks behind a word, and a ,, ], } or : comes right after the close.
  • A redacted shell word drops the header's closing quote (curl -H "Cookie: [redacted] https://...), because that quote was inside the redacted word.
  • A quoted segment that spans lines in the shell is read only to the end of its line, so text on its later lines stays readable. This matches how the header's value already ends at its line.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $96.27

A cookie header in a shell argument (curl -H "Cookie: ...") now runs to
the end of its shell word, so a word or a quoted segment glued behind its
closing quote is redacted. A header string in JSON or a list still ends at
its quote. Follow-up to #8228 (Codex finding 13, Option B).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$96.27`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=96.27 -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T10:41:24.010758Z b1601a2 Manual request
🔒 Security Review ✅ Completed 2026-12-05T10:48:17.433655Z b1601a2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: b1601a24e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

21 agent steps · 6 replayed from cache · 15 model calls · 47.6k tokens (23% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.8s
🟢 a chat survives a restart of the server 1 step · 1 call 5.8s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.4s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.4s
🟢 pluginTrustRestart.e2e.ts · 1 passed 3 steps · 2 calls 9.4s
🟢 a trusted plugin hook stays trusted after the server restarts 3 steps · 2 calls 9.4s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 8.9s
🟢 a chat survives trips through Settings 2 steps · 1 call 8.9s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.6s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.6s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.7s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.7s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.6s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.6s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.3s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.3s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 21.4s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.6s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.2s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.1s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.3s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.2s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.0s

e2e 0.20.0 · 1m 11s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (22% cached)
Spend: $0.02 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.4s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.7s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.7s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 7.9s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 7.9s

e2e 0.20.0 · 21.5s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 6.3s · 2 targets (web, phone) · run artifacts

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: b1601a24e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 merged commit 5b7630b into main Dec 5, 2026
44 of 45 checks passed
@ThomasK33
ThomasK33 deleted the oracles-cookie-shell-word branch December 5, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant