Skip to content

fix(cold-store-reaper): keep Turso credentials out of curl argv in export-turso.sh (#1027) - #1034

Merged
dezren39 merged 2 commits into
mainfrom
queue/1199-1027-turso-stdin-config
Oct 26, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/1199-1027-turso-stdin-config

Conversation

@dezren39

@dezren39 dezren39 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Closes #1027.

Problem

export-turso.sh (PR #993) passed the Turso platform token (discovery + token-mint calls) and each minted per-database JWT (dump download) to curl as -H argv elements — world-readable in the process list for up to 300 s per database, nightly. This is the exposure removed twice before (#948 push-fleet-feed.sh, #983 cold_store.py).

Fix

  • New curl_auth helper in export-turso.sh: the Authorization header travels in a curl config fed on stdin (--config -), mirroring cold_store.py's _curl_fetch. The config is never written to a file and the token is never printed.
  • All three curl calls (discovery, token mint, /dump) route through it. Behaviour otherwise unchanged: discovery, mint, download, integrity check, gzip, put-backup, and skip-when-unset all work as before.

Tests

  • New tests/test_export_turso.py (stub curl on PATH): captures argv + stdin for all three invocations; asserts no credential and no Authorization text in any argv, --config - is used, the header reaches curl via the stdin config (platform token ×2, per-DB JWT ×1), the export is filed with cold-store, and skip-when-unset still exits 0 without calling curl. 2/2 pass.
  • Existing suite: python3 -m unittest discover -s pkgs/cold-store-reaper/tests — 61 tests OK (1 skipped).

Note (per the issue packet, not performed): rotating the Turso platform token is an operator action if wanted; the exposure was local process-list only.

🤖 Queue worker task 1199 (repo-health-code-pilot).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Database export requests now pass authorization credentials through a configuration channel rather than command-line arguments, reducing their visibility in process listings.
    • Export behavior, request timeouts, and error handling remain unchanged. Exports continue to skip successfully when the platform token is unset. The change applies to database discovery, token requests, and dump downloads. No changes to the exported data or the subsequent filing process are visible.

…port-turso.sh (#1027)

All three curl calls (database discovery, per-DB token mint, /dump
download) passed the Authorization header via -H argv, world-readable
in the process list for up to 300s per database. Route them through a
curl_auth helper that feeds the header in a curl config on stdin
(--config -), mirroring cold_store.py _curl_fetch (#983).

Add tests/test_export_turso.py: a stub-curl argv-capture harness that
asserts no credential or Authorization text appears in any argv, the
header reaches curl via the stdin config (platform token x2, per-DB
JWT x1), the export is still filed, and the skip-when-unset path is
unchanged.
@dezren39
dezren39 requested a review from a team as a code owner October 26, 2026 23:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T23:54:12.339181Z e2a3ee6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The Turso export script now sends bearer credentials through curl’s stdin configuration instead of command-line arguments. A new network-free test suite checks credential handling during export and verifies the existing skip behavior when the platform token is unset.

Changes: Turso export credential handling

Layer / File(s) Summary
Move authorization headers out of curl arguments
pkgs/cold-store-reaper/scripts/export-turso.sh
A new helper escapes backslashes and double quotes in bearer tokens and sends the authorization header through curl’s stdin configuration. Database discovery, token minting, and dump downloading use the helper.
Test credential handling and skip behavior
pkgs/cold-store-reaper/tests/test_export_turso.py
Network-free tests capture curl arguments and stdin. They check that credentials do not appear in curl arguments or script output, verify delivery through stdin, and confirm the unset-token skip.

Priority: Pending latest changes

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: High

Possibly related issues

  • None. The matching issue is already directly linked to this pull request.
Merge Risk: Low · up to e2a3e

The credential-handling change has no established runtime defect. Format the new test to avoid a formatting-check failure; adding first-failure, second-success coverage would strengthen regression protection.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dezren39
dezren39 merged commit d95b9c3 into main Oct 26, 2026
3 checks passed
@dezren39
dezren39 deleted the queue/1199-1027-turso-stdin-config branch October 26, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cold-store-reaper: export-turso.sh passes Turso platform token and per-DB JWTs to curl in argv (process-list exposure, PR #993)

1 participant