GeezerVison is showing github.com — cold-store-reaper: export-turso.sh passes Turso platform token and per-DB JWTs to curl in argv (process-list exposure, PR #993) · Issue #1027 · developing-today/code
cold-store-reaper: export-turso.sh passes Turso platform token and per-DB JWTs to curl in argv (process-list exposure, PR #993) #1027DescriptionFinding
pkgs/cold-store-reaper/scripts/export-turso.sh (added by PR #993) passes Turso credentials to curl as -H "Authorization: Bearer …" argv elements. Command-line arguments are world-readable via the process list (ps, /proc/<pid>/cmdline) for the whole life of the curl process — this is exactly the exposure pattern this repo has already removed twice:
Evidence (verified on current main 76672b97df023607d8469d462f21420604fe92d5, cross-checked via gh pr diff 993 and the local clone)
pkgs/cold-store-reaper/scripts/export-turso.sh:
- Line 58–59: platform token in argv,
--max-time 60
curl -fsS --max-time 60 \
-H "Authorization: Bearer ${TURSO_PLATFORM_API_TOKEN}" \
"${API_BASE}/v1/organizations/${ORG}/databases"
- Line 93–94: platform token again in argv for the per-database token mint (
-X POST …/auth/tokens), --max-time 60.
- Line 120–121: the minted per-database JWT in argv for the dump download,
--max-time 300 — up to five minutes of exposure per database:
curl -fsS --max-time 300 \
-H "Authorization: Bearer ${jwt}" \
"${dump_url}" -o "${dump_sql}"
The script's own header says "the script stores nothing and never prints a token value" — true for logs and disk, but argv is a third channel it does not cover. The platform token is long-lived and org-wide (it can mint per-database tokens); the per-DB JWTs are shorter-lived but grant full dump access to that database's contents while valid.
Deduped 2026-10-26: gh issue list --search 'turso curl argv', --search 'export-turso', and --search 'Bearer argv process list' return no existing issue. #983/#986 are closed and cover cold_store.py only, not this script.
Why it matters
Anyone (or any process) able to read the process list on the machine running the nightly backup can harvest the Turso platform token during any of the three curl windows — the dump download window is up to 300s per database, every night. This reintroduces a credential-exposure class the fleet explicitly decided to eliminate (#948, #983).
Acceptance criteria
- No Turso credential (platform token or per-database JWT) appears in any process's argv during
export-turso.sh runs: credentials reach curl via a non-argv channel (e.g. the stdin curl-config pattern _curl_fetch established in fix(cold-store-reaper): keep R2 secret out of curl argv via stdin config (#983) #986, with the header value escaped the same way).
- A regression test in the existing Turso test harness (
TestTursoExportScript) asserts no argv element of any spawned curl contains the platform token or a minted JWT (the fix(cold-store-reaper): keep R2 secret out of curl argv via stdin config (#983) #986 argv-guard test is the precedent).
- Existing behaviour unchanged: skip contract when
TURSO_PLATFORM_API_TOKEN is unset, per-database failure isolation, integrity-check gating, and the existing fake-Turso tests all still pass.
- The script header comment is updated so its credential-handling claim covers argv as well as logs/disk.
Source: PR #993 — #993 (commits db58a67, 00410ed). Filed by the pr-diff-review job, 2026-10-26. Activitydeveloping-today commented on Oct 26, 2026 dezren39 commented on Oct 26, 2026 dezren39 commented on Oct 26, 2026 🤖 Agent note · handed off
dezren39 commented on Oct 26, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|