Skip to content

Secret scan: a PAT on one line must not hide a literal token on another - #1068

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/secret-dedupe-per-value
Nov 13, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
claude/secret-dedupe-per-value

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Follow-up to #1065. It merged at 6a3059a, one commit before this fix, so main currently has the bug below.

detect_secrets/1 also receives whole files (via Rules.scan_file/3). Its de-duplication dropped the generic "Token assignment" label whenever any specific credential (a GitHub PAT, an npm token, …) appeared anywhere in the content. So a file with a PAT on one line and a separate literal DEPLOY_TOKEN=… on another reported only the PAT. Fixing that one finding left the second leaked credential undetected.

The generic label is now dropped only when every value it matched is itself named by a specific matcher — that is, the same secret reported twice.

Codex found this on #1065 (the per-value comparison it asked for).

Testing

New test: one file holding a GitHub PAT and a distinct literal DEPLOY_TOKEN. Both are reported. secret_pattern_gaps_test, scanner_suppression_test and cli_test: 112 tests, 0 failures (local Elixir 1.17 / OTP 25 harness).


Generated by Claude Code

Codex on 6a3059a: detect_secrets/1 also receives whole files (via
Rules.scan_file/3), and the previous de-duplication dropped "Token
assignment" whenever ANY specific credential appeared anywhere in the
content. A GitHub PAT on one line therefore hid a distinct literal
DEPLOY_TOKEN on another.

The generic label is now dropped only when every value it matched is
itself named by a specific matcher -- the same secret twice. A test
covers a PAT and a separate literal token in one file: both are
reported.

685 tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 13, 2026 13:48
@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 13, 2026 13:48

Copy link
Copy Markdown
Owner Author

Red checks: none are from this diff

This PR changes lib/rules/security_errors.ex and its test only. It touches no Rust, Cargo or container file.

  • Build Test Images (and Integration Status, its rollup): Containerfile:58 cargo build --package hypatia-cli exits 101 (TARGET not defined at compile time; error[E0658] atomic_try_update). The image's Rust is older than the host CI toolchain. Red on main too (runs 43357534889, 43264284438).
  • Rust Dependency Audit / Security Status, if red: cargo audit on a transitive advisory (quinn-udp, RUSTSEC-2026-0538). No Cargo files change here.

Codex's code review of this PR found nothing. Its security review could not run because the Codex account is out of credits. Detail in #1064.


Generated by Claude Code

Repository owner deleted a comment from chatgpt-codex-connector Bot Nov 13, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Nov 13, 2026
Repository owner deleted a comment from coderabbitai Bot Nov 13, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 89b406c into main Nov 13, 2026
85 of 88 checks passed
@hyperpolymath
hyperpolymath deleted the claude/secret-dedupe-per-value branch November 13, 2026 16:19
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.

3 participants