Repository navigation
WEB-6954: Apply memory file fixes after the daily root scan - #441
Conversation
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…alls do not exist (WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
1 finding — 0 high-confidence, 1 to triage. Reviewers: Claude, Semgrep, Gitleaks.
- [LOW] Fix tokens and users' memory paths visible on the curl command line 🟡 —
scripts/coding_discovery_tools/memory_fix.py:178- What:
_post_jsonsends each request body through the existing_curl_post_json. The PR's own comment atFILES_PER_POSTsays this body goes on curl's command line. So every user's memory file paths and hashes, and the backend's one-time fixtokens in the results post, end up in the argv of a process running as root. - Why: On macOS, any local user can read other processes' argv with
ps. That lets one user see another user's~/.claudememory file paths, and grab fix tokens while the post is in flight.⚠️ How much this matters depends on whether_curl_post_jsonalso puts the API key on argv (not visible in this diff). A token is only useful to someone who also has the API key. - Fix: Pass the JSON body to curl over stdin (
--data-binary @-) or through a 0600 temp file, not argv. Do this at least for the new memory-fix endpoints, and ideally inside_curl_post_jsonitself. - Flagged by: Claude
- What:
Pre-existing (not introduced by this PR)
- Semgrep
python-logger-credential-disclosureatscripts/coding_discovery_tools/utils.py:2347and:2356. These lines are outside the hunks this PR changed. The log lines print a file path and an exception, not the credential value. Low severity, listed here only for completeness.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head d74fbc95 · 2026-11-27T09:34Z
… (WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
1 finding — 0 high-confidence, 1 to triage. Reviewers: Claude, Semgrep, Gitleaks.
- [LOW] Spans from the backend are applied without a local check that they hold a credential 🟡 —
scripts/coding_discovery_tools/memory_fix_helper.py:193- What:
fix_filechecks only that each span is a sorted, in-bounds[start, end]pair. It never checks that the text inside the span looks like a credential before replacing it with the marker. - Why: The helper runs as the user, and the backend can only target files the agent posted. Even so, a compromised or buggy backend that answers with a matching hash can blank out any text in a
~/.claudememory file. Claude Code loads these files into the model's context. Removing text such as "do not", or an instruction to confirm before running commands, quietly changes how the user's coding agent behaves. The file ends up showing[credential removed by Unbound], so the user is unlikely to notice. - Fix: Before swapping the file in, run
memory_secret_rules.find_secretson the original text, or on each span with a little context around it. Refuse withrefusedwhen a span does not overlap a value the local rules detect. Also cap the number of spans and their total length per file. - Flagged by: Claude
- What:
Pre-existing (not introduced by this PR)
- [MEDIUM] API key in curl's process arguments —
scripts/coding_discovery_tools/s3_uploader.py:269._curl_post_jsonstill passesAuthorization: Bearer {api_key}as a-Hargument, so any local user can read it withps. The PR's own new comment says the process list is world-readable, yet it moves only the request body to stdin. The new fix step polls for up to 20 minutes, which adds more chances to catch the key. Fix: pass the header through stdin or a config file, e.g.-H @-or--config -(curl ≥ 7.55).
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 6732f5ba · 2026-11-27T09:52Z
…WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: Claude (lead), Semgrep, Gitleaks)
Pre-existing (not introduced by this PR)
- [LOW] API key is still visible in the process list —
scripts/coding_discovery_tools/s3_uploader.py:269- What:
_curl_post_jsonpasses-H "Authorization: Bearer {api_key}"as a curl command-line argument. On macOS, any local user can read other users' process arguments withps. - Why it matters here: the header line itself is unchanged. But this PR edits the same argument list to move the request body to stdin "so it stays out of the process list", and the key stays exposed. The new fix polling also adds repeated root curl calls with the key on the command line, for up to 20 minutes per run.
- Fix: keep the header off the command line. For example, write it to a
0600temp file and pass-H @<file>, or put both the header and the body into a curl config that curl reads from stdin (-K -). - Flagged by: Claude
- What:
- The two Semgrep
python-logger-credential-disclosurehits atutils.py:2347andutils.py:2356are on lines this PR does not touch. They log a file path and an exception, not a credential value, so they look like false positives and are not raised here.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 38e1202e · 2026-11-27T10:13Z
…954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… that landed in that instant (WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
/review code |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: Claude lead review, Semgrep, Gitleaks)
Pre-existing (not introduced by this PR)
- [LOW] API key passed on the curl command line —
scripts/coding_discovery_tools/s3_uploader.py:269- What:
_curl_post_jsonpassesAuthorization: Bearer {api_key}as a curl argument (-H). On macOS, any local user can read other users' process arguments withps. - Why: this PR moves the request body to stdin for exactly this reason, but the bearer key stays in the arguments. The new fix step can also poll for up to 20 minutes, so the key stays visible to local users for longer on each root run.
- Fix: pass the header through curl's config on stdin (for example
-K -withheader = "Authorization: Bearer …"), or use-H @filewith a 0600 temp file. That keeps the key out of the process list as well as the body.
- What:
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 1924680a · 2026-11-27T11:03Z
…, ACL and extended attributes (WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ainst a real localhost backend (WEB-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
/review |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: claude, semgrep, gitleaks)
Pre-existing (not introduced by this PR)
- [MEDIUM] API key still passed to curl on the command line —
scripts/coding_discovery_tools/s3_uploader.py:269- What:
_curl_post_jsonpasses-H "Authorization: Bearer {api_key}"as a command-line argument. This PR moves the request body to stdin because the process list is readable by every local user. The bearer key on the line above it is still in that list. - Why: The new
memory-fixes/andmemory-fixes/results/posts use this function too. That adds more windows in which any local account on a shared Mac can read the device API key withps. - Fix: Send the headers through stdin as well. For example, use
-H @-or--config -with the Authorization line, or write a 0600 header file and pass-H @file. - Flagged by: claude
- What:
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 86d22c87 · 2026-11-27T11:21Z
…6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
/review code |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: claude, semgrep, gitleaks)
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head ac8c7504 · 2026-11-27T13:03Z
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: Claude, Semgrep, Gitleaks)
Pre-existing (not introduced by this PR)
- [LOW] Device API key passed to curl on the command line 🟡 —
scripts/coding_discovery_tools/s3_uploader.py:269- What:
_curl_post_jsonstill putsAuthorization: Bearer {api_key}in curl's command-line arguments. Any local user on macOS can read those arguments withps. - Why: The new
body_on_stdinoption moves only the request body to stdin. The code comment gives that same reason ("the process list, which every local user can read"), but the bearer key stays visible. The new fix loop sends many root-run curl requests over a window of up to 20 minutes, so the key is exposed for longer. - Fix: Pass the header through stdin or a config file as well. For example, use
-H @-or--config -with the header written to stdin, or a temp file with mode0600. This removes the key from the command line. - Flagged by: Claude
- What:
- The Semgrep
python-logger-credential-disclosurehits atutils.py:2347andutils.py:2356are on lines this PR did not change. They log a file path and an exception, not a credential value. They are not raised as findings.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 3f012e5a · 2026-11-27T13:24Z
…954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: claude, semgrep, gitleaks)
Pre-existing (not introduced by this PR)
scripts/coding_discovery_tools/s3_uploader.py:269:_curl_post_jsonstill passesAuthorization: Bearer {api_key}as a curl command-line argument. Any local user can read the process list, so they can see the agent's API key while each POST runs. This PR moves the request body to stdin for exactly that reason but leaves the key in argv. It also adds many more of these calls: fix polls and result posts. Fix: pass the header through stdin or a 0600 temp file with-H @file/--config -.- Semgrep
python-logger-credential-disclosureatscripts/coding_discovery_tools/utils.py:2347and:2356: these lines are outside the diff. They log a file path and an exception message, not the credential value. This looks like a false positive, so it is listed for completeness only.
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 5c40a1df · 2026-11-27T14:02Z
…-6954) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
/review code |
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
✅ Security consensus: no issues found. (reviewers: Claude, Semgrep, Gitleaks)
🤖 consensus review · reviewers: Claude, Semgrep, Gitleaks · head 366398c9 · 2026-11-27T14:22Z
Summary
Changes
scripts/coding_discovery_tools/memory_fix_helper.pyscripts/coding_discovery_tools/memory_fix.pycapabilities: ["memory_fix"]when the self-test passes; the fix step runs after thecompletedevent.ai_tools_discovery.py,utils.pytests/test_memory_fix.pyHow it works
~/.claude/.readyanswer it starts the helper as the file's owner.pendingfiles are asked about again every 5 minutes, 5 asks in all (at 0, 5, 10, 15 and 20 minutes).changedfiles and files left out are not asked about again in that run.[credential removed by Unbound]from the end backwards, writes a temp file beside the original, re-checks the original is unchanged, renames, and re-reads.Notes for review
completed.~/.claudeis a symlink gets "refused". This fails safe and is a known limit.sudo), and a packaged binary on a Jamf-managed Mac.Pairs with websentry-ai/ai-gateway-data#3587 and websentry-ai/setup#451. Merge both of those first.
Linear: WEB-6954
🤖 Generated with Claude Code
Unbound Review · Score 5/5 (no findings) ·
366398cfindings: 0 P0 · 0 P1 · 0 P2 (top 5 P0/P1 inline) · engines: codex ✅ · claude ✅
rules applied: CLAUDE.md