Repository navigation
security: string-literal entropy reads lines of 250+ chars (Part of #8429) - #8622
Merged
Merged
Conversation
…8429) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
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.
Part of #8429 (third slice: string-literal entropy on lines of 250+ characters).
What changed
SecurityLens.scan_contentmeasured string-literal entropy on the_armored text, which empties every line of 250+ chars, so a payload literal on a long line was never checked. It now also runs the same boundedstring_extractor(64-1024 chars, same 4.8 threshold, same "fewer than 3 spaces" prose filter, same auto-gen shield) over each raw line of 250+ chars. It reads the raw line rather than the 200-charchunk_long_linespieces: chunking would cut a 300-char literal in two and miss it, and the extractor is already ReDoS-bounded. Positions and counts use the original line number.Files (3 hand-written, plus regenerated golden masters):
gitgalaxy/security/security_lens.py,tests/security_auditing/test_security_lens.py,docs/known_blind_spots.md.Tests
New tests (literal lengths 96/300/700/1000 on a 250+ char line, count + position + snippet; near-misses: low-entropy and prose literals; auto-gen shield; a quote-heavy poison line under
assert_cpu_below). The positive tests fail on the old code (4 failed) and pass now.test_security_lens.pyandtest_redos_poison.py: 138 passed.Class / Sibling gaps
Class: every security consumer of
scan_contentand the armored text. Members: the 13THREAT_SIGNATURESkeys,hardcoded_secrets, string-literal entropy, SBOM payload audit,--fail-on-secrets, Vault Sentinel, X-Ray.hardcoded_secrets: handled (security: hardcoded_secrets reads lines of 250+ characters (Part of #8429) #8603).sbom_recorder.py:246callssecurity.scan_content(content), so it inherits all three slices.--fail-on-secretsreads the same engine counts: inherits.dead_code(reads comment text the code stream blanks; one finding is one line) andhomoglyphs(needs its whole line to judge a script) still skip lines of 250+ chars: different mechanism; listed indocs/known_blind_spots.md. A literal over 1024 chars is not entropy-checked (the extractor's own bound); also recorded there.Performance / golden impact
Adds work only on files with a line of 250+ chars (one extractor pass over those lines; the extractor's per-quote scan is capped at 1024 chars). Golden masters re-blessed through
golden-lock.sh ... crucible_check.py --update --yes(both legs). The drift is all long-line entropy:Security: High-Entropy Strings+1 on four files (zig/bun napi.zig 2->3, perl exiftool ExifTool.pm 1->2, zig/zls langref.html.in 0->1, typescript/playwright README.md 0->1), their DNA-hit hashes, the GPU/SARIF/LLM-brief digests, and X-Rayanomalies_found64 -> 67.Gates
pr_gates --fast: 9/9 pass.pr_gates --ratchets: cics-spec, ports, port-surface, estate, det-mutation, time pass; fact-crosscheck, completeness and ground-truth FAIL only because the mainframe corpusexample-health-apisis not fetched at its pinned ref on this box (environmental, COBOL corpora, unrelated to the security lens; not re-run). Golden check: drift above, blessed.Co-Authored-By: Claude Sonnet 5.5 [email protected]
🤖 Generated with Claude Code