feat(llm-security): v7.0.0 commit 7 — rule 18 (markdown image URL suppression)
E2E verification against content-heavy repo (`content-claude-code`) revealed 413 entropy findings (8 HIGH / 405 MEDIUM) from markdown image CDN URLs in JSON content indexes — e.g., ``. These are legitimate content-repo artifacts, not credentials. The 40-char hash segment in the CDN URL trips Shannon entropy (H=5.29 over 300 chars), and rule 13 (inline <svg>) doesn't match since there's no literal `<svg>` tag — the `.svg` is just a URL path suffix. Added rule 18 `MARKDOWN_IMAGE = /!\[[^\]]*\]\(\s*https?:\/\//` — matches `` / ``. Line-level (not string-level) so URL is not over-specific. E2E impact on `content-claude-code`: - Before: BLOCK / 65 / 8H 437M 0L - After: WARNING / 56 / 3H 427M 0L Hyperframes unchanged: BLOCK / 80 / 1C 4H 92M — real CRITICAL SQL-injection and HIGH findings still detected. Tests: 2 new (positive + negative fixture) bringing entropy-context to 26, total suite 1485 → 1487. Docs updated to "rules 11-18" and "8 new line-suppression rules". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5a4f29fd14
commit
765bc74f52
7 changed files with 43 additions and 9 deletions
|
|
@ -186,6 +186,28 @@ describe('entropy-scanner context suppression (v7.0.0+)', () => {
|
|||
assert.equal(result.findings.length, 0, 'expected throw new Error line to suppress');
|
||||
await rm(fx, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('rule 18: markdown image with external URL suppresses finding', async () => {
|
||||
const fx = await newRoot('ent-rule18-');
|
||||
await writeFixture(fx, 'index.json',
|
||||
'{"summary": ""}');
|
||||
resetCounter();
|
||||
const discovery = await discoverFiles(fx);
|
||||
const result = await scan(fx, discovery);
|
||||
assert.equal(result.findings.length, 0, 'expected markdown image line to suppress');
|
||||
await rm(fx, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('rule 18 does NOT over-match plain URLs without image syntax', async () => {
|
||||
const fx = await newRoot('ent-rule18b-');
|
||||
await writeFixture(fx, 'app.js',
|
||||
'const token = "' + PAYLOAD + '"; // not an image');
|
||||
resetCounter();
|
||||
const discovery = await discoverFiles(fx);
|
||||
const result = await scan(fx, discovery);
|
||||
assert.ok(result.findings.length >= 1, 'plain high-entropy string must still be detected');
|
||||
await rm(fx, { recursive: true, force: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('C. Policy-driven overrides', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue