Skip to content

security: hardcoded_secrets reads lines of 250+ characters (Part of #8429) - #8603

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8429-20261118T1300Z
Nov 18, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8429-20261118T1300Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #8429 (security epic #8427). First slice: hardcoded_secrets reads lines of 250+ characters.

What changed

  • SecurityLens.scan_content (gitgalaxy/security/security_lens.py) re-reads each line of 250+ characters in overlapping pieces (long_lines.CHUNK / OVERLAP, the same sizes Vault Sentinel uses) for the hardcoded_secrets signature only. Each piece is under the armor limit, so the regex stays bounded. Counts, snippets, positions and sites carry the ORIGINAL file's line and column. A value seen by two overlapping pieces counts once (span overlap).
  • Docs: docs/known_blind_spots.md and gitgalaxy/security/README.md now say secrets read long lines and everything else still does not.
  • Tests (tests/security_auditing/test_security_lens.py): a planted AWS key at the start, middle and end of lines of 250, 300, 449 and 1000 characters (count, line, column); a near-miss (value under the 16-character floor); the chunk-overlap case (counted once); a poisoned 5 KB+ line bounded by CPU time (tests/_timing.py).

Class / Sibling gaps

Class: every security consumer of SecurityLens._armor output, which blanks lines of 250+ characters. Handled here: hardcoded_secrets (the credential lexicon and token formats share one regex). Vault Sentinel was already handled (chunked).

Sibling gaps (not done here; different mechanism or risk, listed rather than filed):

  • The other 12 THREAT_SIGNATURES keys (high_risk_execution, io, state_mutation, ...): still blind on long lines. test_minified_fallback_mass_threshold_evasion pins that for high_risk_execution; chunking them would split multi-token patterns and shift golden counts, so each needs its own look.
  • String-literal entropy (4.8 threshold): reads armored text; a long literal cut into pieces changes the entropy, so it needs a windowed design.
  • SBOM payload audit in sbom_recorder.py: unverified whether it calls scan_content.
  • --fail-on-secrets gate: inherits this fix for secrets; no CLI-level test with a long-line secret yet.
  • X-Ray: separate path, out of scope.

Remaining slices

  1. Chunk the other signatures (or write each into docs/known_blind_spots.md), test_security_lens.py + security_lens.py.
  2. Entropy over long literals.
  3. CLI test: --fail-on-secrets with a 300+ character line (test_cli_contract.py).

No detection-effectiveness claim is made: this only makes the existing hardcoded_secrets regex run on text it previously never saw.

Performance and golden impact

Extra work only on lines of 250+ characters (one finditer per 120 characters of such a line); files with no long line pay one len() per line. crucible_check.py (both legs, golden-lock.sh): full_precision PASS, zero_dependency PASS, so no golden changed. No perf-ab run; the default path is untouched for files without long lines.

Gates

  • pr_gates.py --fast: 9/9 pass. pytest tests/security_auditing: 901 passed.
  • pr_gates.py --ratchets: cics-spec, ports, port-surface, estate, det-mutation, time PASS. fact-crosscheck, completeness and ground-truth FAIL on this box because a mainframe corpus is not fetched at its pinned ref (example-health-apis); not rerun against main, and the change touches no COBOL path. CI is the check for these.

Lessons for agents

None.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 18, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 18, 2026 13:34
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 18, 2026 13:34
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant