Repository navigation
Description
Finding
PR #976 (merged 2026-10-26, fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver) added a curl fallback for S3 downloads in pkgs/cold-store-reaper/cold_store.py. The fallback passes the R2 credentials to curl as a command-line argument:
cold_store.py_curl_fetch(on current maind715adf9, ~lines 1526–1545) buildsargv = [curl, "-sS", "--fail", "--aws-sigv4", "aws:amz:auto:s3", "--user", f"{access}:{secret}", url]and runs it withsubprocess.run. The docstring acknowledges it: "Credentials travel in argv — the local process list sees them, as with any credentialed CLI".- Introduced in PR fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver #976, commit
14617a5958(fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver).
Any local process can read another process's argv (ps, /proc/<pid>/cmdline), so the bucket-scoped R2_SECRET_ACCESS_KEY is exposed for the whole duration of the download — and this fallback exists specifically for the large objects, with S3_CURL_TIMEOUT_SECONDS = 900, so the exposure window can be minutes long. The PR does scrub the credentials from error text, but that does not address the argv exposure itself.
Why it matters
This is the exact pattern this repo removed the same day, twice:
- Issue security(aggregator): fleet-feed push exposes the proxy credential in process argv and disables SSH host-key verification #948 / PR security(aggregator): keep fleet-feed proxy credential off argv, pin laptop host key #970 (merged ~1 hour before fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver #976): the fleet-feed push's socat
ProxyCommandembeddedproxyauth=<user>:<pw>in process argv; the fix replaced it with an in-process CONNECT relay that keeps the credential off every process's argv, and addedpm-stack/aggregator/scripts/push-fleet-feed.guard.sh, whose stated rule is: "proxy credential must never be an argv token". That guard only coverspush-fleet-feed.sh, so fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver #976's reintroduction in another package was not caught. - The scrubbing in fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver #976 protects logs, not the process list — the leak channel security(aggregator): fleet-feed push exposes the proxy credential in process argv and disables SSH host-key verification #948 was about.
Fix direction (triage decides): keep the credential out of argv — e.g. hand curl its config via a stdin config (curl -K - / --config from a pipe or a mode-600 temp file that is unlinked after use, with user = "access:secret" inside), or sign the request in-process like the urllib path already does and let curl send a pre-signed request, or another mechanism the worker verifies. The byte-count verification and the one-attempt semantics of the fallback must stay.
Acceptance criteria
- The R2 access key / secret never appear in any spawned process's argv on the curl fallback path (verifiable: a test stubs
subprocess.run— or inspects the spawned argv — and asserts neither credential value is present in any argv element). - The curl fallback still works end-to-end: existing
TestS3CurlFallbackcoverage (fallback only after urllib exhaustion, byte-count verified against caller size or HEAD, errors scrubbed and named) passes, updated for the new credential channel. - Credentials remain scrubbed from all error text raised on this path.
- Consider a repo-level guard in the spirit of
push-fleet-feed.guard.shso a--user <access>:<secret>-style argv pattern incold_store.pyfails a check instead of relying on review to catch it. - The
_curl_fetchdocstring / README wording no longer presents argv credentials as acceptable.
Found by the pr-diff-review job reviewing PR #976 against current main.
Activity
developing-today commentedon Oct 26, 2026
CODE-168
dezren39 commentedon Oct 26, 2026
🤖 Agent note · state: filed
cold_store.py_curl_fetch), the pattern security(aggregator): fleet-feed push exposes the proxy credential in process argv and disables SSH host-key verification #948/security(aggregator): keep fleet-feed proxy credential off argv, pin laptop host key #970 removed the same day; a triage packet has been enqueued for verification against current main.8 remaining items
dezren39 commentedon Oct 26, 2026
🤖 Agent note · picked up
style(cold-store-reaper): ruff format the argv guard test (#983)
Merge pull request #986 from developing-today/queue/1139-983-curl-std…
dezren39 commentedon Oct 26, 2026
🤖 Agent note · done
_curl_fetchnow feeds curl its config on stdin (--config -+subprocess.run(input=...)); the R2 secret never appears in argv or on disk. TestS3CurlFallback 5/5 locally including the new argv guard test; CI green (treefmt, Nix flake evaluation, run) before merge.