Skip to content

security: string-literal entropy reads lines of 250+ chars (Part of #8429) - #8622

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

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

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #8429 (third slice: string-literal entropy on lines of 250+ characters).

What changed

SecurityLens.scan_content measured 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 bounded string_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-char chunk_long_lines pieces: 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.py and test_redos_poison.py: 138 passed.

Class / Sibling gaps

Class: every security consumer of scan_content and the armored text. Members: the 13 THREAT_SIGNATURES keys, 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).
  • One-line signatures (reflection_metaprogramming, safety_bypasses, io, high_risk_execution, state_mutation, bitwise_ops, shadow_imports, db_hooks, unicode_steganography, self_propagation): handled (security: every one-line signature reads lines of 250+ chars in chunks (Part of #8429) #8615).
  • Entropy: handled here.
  • SBOM payload audit: verified, sbom_recorder.py:246 calls security.scan_content(content), so it inherits all three slices. --fail-on-secrets reads the same engine counts: inherits.
  • Vault Sentinel: handled earlier (chunked). X-Ray: separate path, out of scope.
  • Sibling gaps: dead_code (reads comment text the code stream blanks; one finding is one line) and homoglyphs (needs its whole line to judge a script) still skip lines of 250+ chars: different mechanism; listed in docs/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-Ray anomalies_found 64 -> 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 corpus example-health-apis is 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

@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 18:31
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

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

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot merged commit 46e7c81 into main Nov 18, 2026
93 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/8429-20261118T1728Z branch November 18, 2026 18:43
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