fix(cve): KEV from CISA's GitHub mirror, exploitation cached per source (#493) #525

Merged
sharang merged 1 commits from fix/493-kev-mirror into main 2026-10-06 19:02:53 +00:00
Owner

Stage pre-verification of check 19 found two problems:

  • every scan logs KEV catalog not read: … 403 Forbidden, because www.cisa.gov blocks datacenter addresses (stage and the prod host both get 403);
  • cve_exploitation stays empty, because a CVE was cached only when all three sources answered. So the EPSS and Vulnrichment answers were thrown away and fetched again on every scan.

Changes:

  • KEV source: read from CISA's official mirror cisagov/kev-data on raw.githubusercontent.com (same JSON, CC0; checked: catalog 2026.10.04, 1734 entries), falling back to www.cisa.gov.
  • Per-source cache:
    • KEV comes from the cached catalog (one row in cisa_kev) on every run.
    • A cve_exploitation row holds EPSS and SSVC with epss_answered / ssvc_answered, written with $set / $unset per answered source and $setOnInsert for the expiry.
    • A failed source is asked again alone on the next scan.
    • Rows from before carry no flags and are asked again once.
  • Docs: docs/reference/tools.md (source table and egress row) and test plan check 19 (marked FAIL, fixed in the pre-verification table).

Tests:

  • cargo test -p compliance-agent --lib cve_enrichment, 12 tests, including the Mongo write path against a local mongo:7. That test is skipped without Mongo.
  • clippy with the CI flags; fmt.

On stage after the deploy:

  • no KEV catalog not read line;
  • counts.failed: [];
  • cisa_kev has one row;
  • cve_exploitation fills, with epss_answered: true, ssvc_answered: true;
  • a second scan reports the CVEs as cached.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Stage pre-verification of check 19 found two problems: - every scan logs `KEV catalog not read: … 403 Forbidden`, because www.cisa.gov blocks datacenter addresses (stage and the prod host both get 403); - `cve_exploitation` stays empty, because a CVE was cached only when all three sources answered. So the EPSS and Vulnrichment answers were thrown away and fetched again on every scan. Changes: - **KEV source:** read from CISA's official mirror `cisagov/kev-data` on raw.githubusercontent.com (same JSON, CC0; checked: catalog 2026.10.04, 1734 entries), falling back to www.cisa.gov. - **Per-source cache:** - KEV comes from the cached catalog (one row in `cisa_kev`) on every run. - A `cve_exploitation` row holds EPSS and SSVC with `epss_answered` / `ssvc_answered`, written with `$set` / `$unset` per answered source and `$setOnInsert` for the expiry. - A failed source is asked again alone on the next scan. - Rows from before carry no flags and are asked again once. - **Docs:** `docs/reference/tools.md` (source table and egress row) and test plan check 19 (marked FAIL, fixed in the pre-verification table). Tests: - `cargo test -p compliance-agent --lib cve_enrichment`, 12 tests, including the Mongo write path against a local mongo:7. That test is skipped without Mongo. - clippy with the CI flags; fmt. **On stage after the deploy:** - no `KEV catalog not read` line; - `counts.failed: []`; - `cisa_kev` has one row; - `cve_exploitation` fills, with `epss_answered: true, ssvc_answered: true`; - a second scan reports the CVEs as `cached`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-06 18:50:27 +00:00
fix(cve): KEV from CISA's GitHub mirror, exploitation cached per source (#493)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 12m6s
ad1394af4f
On stage and prod www.cisa.gov answers 403 to the datacenter, so the KEV
catalog was never read. Since a CVE's row was cached only when KEV, EPSS
and Vulnrichment all answered, cve_exploitation stayed empty and every
scan asked EPSS and Vulnrichment again.

- KEV is read from CISA's mirror cisagov/kev-data on
  raw.githubusercontent.com (same feed, CC0), with www.cisa.gov as the
  fallback.
- KEV is applied from the cached catalog on every run and no longer
  stored per CVE. A cve_exploitation row keeps EPSS and SSVC, each with
  an *_answered flag, merged with $set so a later answer keeps the
  other's. A source that failed is asked again alone; a row expires a
  day after its first write. Rows from before have no flag and are asked
  again.
- Tests: KEV fallback after a 403, a blocked KEV that keeps EPSS and
  SSVC, a retry that asks only EPSS, the merge, old rows, and the Mongo
  write path (skipped without Mongo).
- Docs: tools reference (source and egress rows), test plan check 19.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit e1bf9e861c into main 2026-10-06 19:02:53 +00:00
Sign in to join this conversation.