Skip to content

test(advisory): port gen-advisory unit suite + canonical advisories tree - #7

Open
MarkAtwood wants to merge 3 commits into
masterfrom
feat/advisory-test-infra
Open

test(advisory): port gen-advisory unit suite + canonical advisories tree#7
MarkAtwood wants to merge 3 commits into
masterfrom
feat/advisory-test-infra

Conversation

@MarkAtwood

Copy link
Copy Markdown

Restores advisory-generator test coverage dropped in the wolfGlass consolidation: ports the 720-line stdlib test_gen_advisory.py gate + its testdata/ fixtures into central/, wires it into selftest.yml, and vendors the canonical advisories/ tree (records + vex-overlay.json) that gen-advisory/make advisory reads by default. 62 tests pass.

Base of the advisory fix stack — the three advisory fix PRs (#1 path-traversal, CDX per-product, overlay validation) build on this because they add tests to the file introduced here. Merge this first.

sameehj and others added 3 commits July 23, 2026 15:54
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
The consolidation dropped the live advisory data that gen-advisory reads
by default (advisories/records/*.json + advisories/vex-overlay.json), so
a bare `gen-advisory` / `make advisory` had no input. Vendor it from the
wolfSSL source of truth. Also the fixture the ported test's canonical-tree
case needs.
Port the stdlib gen-advisory test gate and its frozen testdata/ CVE
fixtures into central/ (beside gen-advisory), and wire it into
selftest.yml. Restores CI coverage for the advisory generator dropped
during the wolfGlass consolidation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores and formalizes test coverage for the central/gen-advisory generator by porting the previously-stdlib unit/semantic test suite and adding committed, hermetic CVE record fixtures plus a canonical advisories/ input tree that the generator can consume by default.

Changes:

  • Add central/test_gen_advisory.py (stdlib-only) covering record parsing, CSAF/CycloneDX emission invariants, overlay vocabulary, and CLI behavior/reproducibility.
  • Add committed CVE JSON fixtures under central/testdata/ and vendor canonical advisory inputs under advisories/ (records + vex-overlay.json).
  • Wire the advisory unit suite into .github/workflows/selftest.yml (syntax check + unittest execution).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
central/testdata/README.md Documents the hermetic CVE fixture set used by the advisory generator tests.
central/testdata/CVE-2026-5999.json Adds a synthetic CVE record fixture to exercise CVSS v3.1 → CSAF scores[] emission.
central/testdata/CVE-2026-5778.json Adds a real CVE record fixture (CVSS v4) for generator tests.
central/testdata/CVE-2026-5501.json Adds a real CVE record fixture (CVSS v4) for generator tests.
central/test_gen_advisory.py Adds the ported unit + semantic test suite for central/gen-advisory.
advisories/vex-overlay.json Adds the canonical VEX overlay consumed by default advisory generation flows.
advisories/records/CVE-2026-5778.json Vendors the canonical CVE record into the default advisories tree.
advisories/records/CVE-2026-5501.json Vendors the canonical CVE record into the default advisories tree.
.github/workflows/selftest.yml Runs advisory unit tests in CI and includes the file in syntax-check compilation.
Comments suppressed due to low confidence (1)

central/test_gen_advisory.py:10

  • This docstring still references scripts/test_gen_sbom.py and a non-existent .github/workflows/advisory.yml. Since this repo’s unit gate is wired through tests/test_gen_sbom.py and .github/workflows/selftest.yml, the wording should be updated to avoid pointing readers at files that aren’t present.
These tests are pure stdlib (no network, no pip deps) so they form the cheap
PR gate, mirroring scripts/test_gen_sbom.py.  They cover three things the
JSON-schema validators in .github/workflows/advisory.yml do NOT:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2 to +6
"""Unit + semantic tests for scripts/gen-advisory.

Run from the repo root:

python3 -m unittest scripts/test_gen_advisory.py
Comment on lines +3 to +5
CVE Program records (CVE JSON 5.x) used by `scripts/test_gen_advisory.py` and
the `.github/workflows/advisory.yml` jobs. Committed so the tests are hermetic
(no network fetch from cve.org at test time).
@@ -0,0 +1,21 @@
{
"_comment": "Canonical wolfSSL VEX overlay consumed by `make advisory` / `scripts/gen-advisory`. Keyed by CVE id; carries the determinations the CVE Program record cannot express (analysis state, justification, fixed versions, remediation, optional FIPS product, optional build-reachability hedge). Constrained by scripts/advisory-vex-overlay.schema.json. To model a wolfCrypt FIPS module as a separate product, add a \"fips\" block per the format in scripts/advisory-vex-overlay.example.json using the real validated module version and CMVP certificate number (do NOT copy the illustrative placeholder values from the example).",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants