fix(EXPOSED_SECRETS): redact detected secrets in finding evidence#44
Open
dmchaledev wants to merge 1 commit into
Open
fix(EXPOSED_SECRETS): redact detected secrets in finding evidence#44dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
The secret-scanning rule printed each matched credential verbatim in the finding's `evidence` field (truncated only past 60 chars). That evidence flows into the scan report's stdout/JSON output and any artifact or CI log derived from it, so the scanner re-exposed the very secrets it exists to flag — an ironic and real leak for a tool sold as a CI/CD security gate. Report matches by type and length only (e.g. "OpenAI API key (29 chars, redacted)"), never the value. Secret patterns are now named to drive the type label. Adds EXPOSED_SECRETS tests (previously uncovered) asserting the rule fires and that no raw credential appears anywhere in the finding. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVdyf7Ehsa8z1kBq7LX5NA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
EXPOSED_SECRETSrule — the check that exists to keep credentials out of plaintext config — echoes each detected secret verbatim in its own report.src/rules/runtime-rules.tspushed the raw matched string intoevidence, truncated only past 60 chars:That
evidencefield flows into the scan report's default JSON/stdout output, and into any CI log or stored artifact derived from it. So a tool sold as a CI/CD security gate re-exposes the very secrets it flags — most real credentials (AWSAKIA…= 20 chars, GitHubghp_…= 40, OpenAIsk-…) are ≤ 60 chars and printed in full.Repro (built CLI, before this change)
Fix
Report each match by type and length only, never the value. Secret patterns are now named (
{ name, pattern }) to drive a human-readable type label:The finding still tells the user exactly what and how many secrets were found — enough to locate them in their own config — without reproducing the credential.
Tests
Adds an
EXPOSED_SECRETSsuite (the rule previously had zero coverage):rawStringsis absent.All 122 tests pass;
npm run buildandnpm run lintare clean.Scope
Localized to the
EXPOSED_SECRETSrule body + pattern list, plus tests and a CHANGELOG note. No rule IDs, severities, or public types change. Independent of the current open backlog (#11/#19/#26/#27/#39) — none touch secret-evidence redaction.🤖 Generated with Claude Code
https://claude.ai/code/session_01HVdyf7Ehsa8z1kBq7LX5NA
Generated by Claude Code