Skip to content

fix(redact): catch URL-embedded credentials and sk-svcacct/admin keys - #82

Merged
sandstream merged 1 commit into
mainfrom
fix/redaction-false-negatives
Jun 24, 2026
Merged

sandstream merged 1 commit into
mainfrom
fix/redaction-false-negatives

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Two redaction false-negatives (security audit):

  • Connection-string passwords (postgres://user:pw@host, redis://:pw@host) passed through — kv-secret stops at :/@. Added a url-credentials pattern that redacts only the password and keeps scheme/user/host (via a new optional per-pattern replacement).
  • Modern OpenAI sk-svcacct-… / sk-admin-… keys missed (internal hyphen breaks the bare sk-[alnum]{40,} run). Broadened the prefix list.

Tests: DB-URL redaction (host kept), userless redis URL, plain ported URL untouched (no false positive), service-account key. ReDoS-safe.

(Replaces #77, reopened from a clean single-commit branch.)


Generated by Claude Code

Two redaction false-negatives found during a security review:

- Connection-string passwords (`postgres://user:pw@host`, `redis://:pw@host`,
  `mongodb+srv://…`) passed through unredacted: the `kv-secret` class stops at
  the `:`/`@`. Added a `url-credentials` pattern that redacts ONLY the password
  and keeps scheme/user/host as diagnostic context (via a per-pattern
  `replacement` — new optional field on RedactPattern).
- Modern OpenAI `sk-svcacct-…` / `sk-admin-…` keys missed: their internal hyphen
  breaks the bare `sk-[alnum]{40,}` run. Broadened the `ai-api-key` prefix list.

Tests cover the DB-URL redaction (password gone, host kept), a userless redis
URL, a plain ported URL staying untouched (no false positive), and the
service-account key. ReDoS-safe (no nested quantifiers).

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 2b6f604 into main Jun 24, 2026
27 checks passed
@sandstream
sandstream deleted the fix/redaction-false-negatives branch June 24, 2026 04:16
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