Skip to content

security(cold-store-reaper): PR #976's curl S3 fallback passes the R2 secret in argv — the pattern #948/#970 removed the same day #983

Closed

Description

@dezren39

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 main d715adf9, ~lines 1526–1545) builds argv = [curl, "-sS", "--fail", "--aws-sigv4", "aws:amz:auto:s3", "--user", f"{access}:{secret}", url] and runs it with subprocess.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:

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 TestS3CurlFallback coverage (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.sh so a --user <access>:<secret>-style argv pattern in cold_store.py fails a check instead of relying on review to catch it.
  • The _curl_fetch docstring / README wording no longer presents argv credentials as acceptable.

Found by the pr-diff-review job reviewing PR #976 against current main.

Activity

  1. added
    kind/securitySecurity issue or security hardening
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/highImportant and time-sensitive
    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)
    on Oct 26, 2026
  2. developing-today commented on Oct 26, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 26, 2026
  5. 8 remaining items

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 26, 2026
  7. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. added a commit that references this issue on Oct 26, 2026
  9. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/securitySecurity issue or security hardeningpriority/highImportant and time-sensitivesource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions