Repository navigation
🤖 fix: redact what the shell joins onto a quoted cookie header - #8244
Conversation
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 -->
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🟢 e2e stories (Haiku): 14 passed21 agent steps · 6 replayed from cache · 15 model calls · 47.6k tokens (23% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 11s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (22% cached) All 3 tests in 3 files
e2e 0.20.0 · 21.5s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 6.3s · 2 targets (web, phone) · run artifacts |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
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=VALUEand-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:-H ",echo '). Behind[,{,,,:or=it still opens a JSON or list item, whose closing quote ends the value. So["Cookie: a","Accept: */*"]keeps"Accept: */*".shellValueEndextends 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.\'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.Validation
tests/oracles/memorySecretRedaction.oracle.ts:\', 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.:.main(33 of 206 tests fail), GREEN here (206 pass).make test-oracles): 96 gaps, all already open onmain(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.memorySecretRedaction.test.tscovers the shell forms raw and JSON-escaped, the unclosed segment, the JSON items that stay, and the guards.memoryToolText.test.tsadds the Codex repro:renderToolValueof a tool result whose stdout holds the curl line, raw or JSON-escaped. It fails onmainand passes here. ThememoryServiceandmemoryConsolidationtests pass.make static-checkpasses exceptlint-hadolint, which is not installed on this host; this PR changes no Dockerfile. ESLint,make crap-checkandmake dry-checkpass.Risks
,,],}or:comes right after the close.curl -H "Cookie: [redacted] https://...), because that quote was inside the redacted word.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$96.27