Skip to content

feat(cyber): add advisory evidence context - #3088

Draft
drk-ram wants to merge 1 commit into
xerj-org:mainfrom
drk-ram:feat/cyber-advisory-2776
Draft

drk-ram wants to merge 1 commit into
xerj-org:mainfrom
drk-ram:feat/cyber-advisory-2776

Conversation

@drk-ram

@drk-ram drk-ram commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What this changes, and why

Add xerj_common::cyber_advisory with CveContext and CyberAdvisory. Known CVE/GHSA identifiers resolve only from supplied OSV, RustSec, or CVE corpus records and return cited affected/patched versions, exact affected-code locations, a full fix SHA, and cited similar bugs. Malformed or absent identifiers return AdvisoryError::UnknownAdvisoryId without fabricated data. Advisory drafting is citation-checked line by line, rejects uncited or slop prose, supports optional CVSS/EPSS/KEV summaries, and seals RFC 8785 JSON with report_sha256.

Refs #2776, #2767, #2769

Audit: reviewed malformed and unknown identifiers, GHSA case normalization, full-SHA constraints, citation/reference integrity, exact code locations, uncited factual claims, filler/placeholders, and tamper detection. No network fetch, persistence, publication, or recommendation behavior is introduced.

Evidence

cargo fmt -p xerj-common --check
PASS.
cargo clippy -p xerj-common --all-targets -- -D warnings -A clippy::chunks_exact_to_as_chunks
PASS.
cargo build --release -j 32 -p xerj-common
PASS: release profile completed in 2.70s.
cargo test -p xerj-common --lib cyber_advisory
PASS: 4 passed; 0 failed; 0 ignored; 389 filtered out.

Checks

  • cargo fmt --all (CI runs rustfmt --check and clippy -D warnings)
  • Scoped release build of the crates touched: cargo build --release -j 32 -p xerj-common
  • cargo test -p xerj-common passes (cargo check is not sufficient — targeted cyber_advisory coverage shown above)
  • ES-YAML conformance suite at 0 failed (cargo run --release -p es-yaml-runner -- --dir tests/es-compat-yaml/yaml) — N/A: no ES query/index behavior changed.
  • New ES-compatible behaviour has a matching YAML case under engine/tests/es-compat-yaml/yaml/ — N/A: no ES-compatible behavior added.
  • Docs updated if user-visible behaviour changed
  • For non-trivial changes: the applicable audit in docs/CONTRIBUTION_REVIEW.md
  • For non-trivial changes: operational audit — N/A: docs/cyber-advisory.md documents a library API, not an operational or runnable recipe; no artifact is extracted, installed, published, or served.

Not run: Full crate/workspace test suites and ES-YAML conformance were not run; the requested scoped module validation and release build are listed above. External corpus fetching and recipe-runner wiring remain outside this PR.

Provenance

  • Written by: @drk-ram
  • Verified (commands run, output observed): exact fmt, clippy, release-build, and four-test module commands above; CVE/GHSA resolution, unknown-ID refusal, citation enforcement, slop rejection, and JCS tamper cases.
  • Assumed (not tested, and what would falsify it): callers supply authentic corpus records and resolve original pinned bytes; a mutable or mismatched corpus source would falsify provenance. Integration with cyber.score remains caller-owned in this isolated module PR.

@cla-bot cla-bot Bot added the cla-signed label Nov 10, 2026
@drk-ram
drk-ram marked this pull request as draft November 15, 2026 19:59
@xerj-team

Copy link
Copy Markdown
Collaborator

Thank you @drk-ram, this is careful work and it is tied to a roadmap issue. Holding it for now: it adds a large new cyber-pack subsystem to xerj-common, and whether and in what order those pieces land is a product decision the maintainer will make, not a review-only call. CI also cannot run at the moment. Nothing is needed from you right now. We will come back here once that decision is made.

@drk-ram
drk-ram force-pushed the feat/cyber-advisory-2776 branch 4 times, most recently from 0b9d2ea to 4dacbfd Compare November 21, 2026 20:46
@xerj-team

Copy link
Copy Markdown
Collaborator

Draft review: what blocks moving this out of draft.

Blocker: AdvisoryScoreSummary accepts bare cvss_score, epss_probability and kev_known_exploited values. It records no provenance (corpus, pin_sha, fetched_at) and never checks the score against cvss_vector. The advisory text then prints those values next to cited facts. This is the gap that #3024 closes.

To un-draft: rebase on #3024 and replace AdvisoryScoreSummary with its CvssEvaluation plus ThreatIntelField<EpssData> and ThreatIntelField<KevData>, so that the score is computed from the vector and missing EPSS or KEV data is stated as absent. Also emit the advisory's finding through #2968's CyberFinding with scenario: Advisory, instead of a separate schema.

What looks right already:

  • Unknown IDs return UnknownAdvisoryId and fabricate nothing.
  • Advisory drafting is citation-checked line by line.

Local merge with main at 34a14c0d8: fmt clean, clippy -D warnings clean, cyber_advisory tests 4/4 passed.

Refs xerj-org#2776, xerj-org#2767, xerj-org#2769

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram force-pushed the feat/cyber-advisory-2776 branch from 4dacbfd to f219562 Compare November 24, 2026 20:01

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants