Skip to content

fix(secrets-sync): redact secret values from sync error messages [HIGH] - #72

Merged
sandstream merged 1 commit into
mainfrom
fix/secrets-sync-error-leak
Jun 24, 2026
Merged

sandstream merged 1 commit into
mainfrom
fix/secrets-sync-error-leak

Conversation

@sandstream

@sandstream sandstream commented Jun 23, 2026 •

Copy link
Copy Markdown
Owner

syncToGitHub pushed raw (err as Error).message into failed[], printed by kit secrets sync. execFile errors embed the full argv, so a failed gh secret set … --body <value> (bad token, rate-limit, missing perms) leaked every secret in cleartext to stdout/CI logs. The REST path leaked the same way.

Fix: export the existing safeErrorMessage(err, [value]) (exact-substring + pattern redaction) and use it on both sync error paths. secrets-migrate.ts already guarded its writes; sync didn't. Test added. (Security audit finding.)

…es [HIGH]

`syncToGitHub` pushed raw `(err as Error).message` into `failed[]`, which
`kit secrets sync` prints to stdout (and into any CI log). execFile errors embed
the full argv in the message, so a failed `gh secret set … --body <value>` — a
common failure path (bad token, rate-limit, missing repo perms) — leaked every
secret being synced in cleartext. The REST/libsodium path had the same raw-message
leak. This is exactly the leak class the Redacted/`safeErrorMessage` work exists
to stop; `secrets-migrate.ts` already guarded its writes, but sync didn't.

Fix: export the existing `safeErrorMessage(err, [value])` (exact-substring +
pattern redaction) and use it on both sync error paths, so the secret is masked
before it can reach `failed[]`/stdout/CI logs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 8fd1069 into main Jun 24, 2026
15 checks passed
@sandstream
sandstream deleted the fix/secrets-sync-error-leak branch June 24, 2026 04:14
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.

2 participants