Skip to content

feat(photon-oval): add Photon OS OVAL vulnerability source#645

Draft
DmitriyLewen wants to merge 9 commits intoaquasecurity:mainfrom
DmitriyLewen:feat/photon-oval
Draft

feat(photon-oval): add Photon OS OVAL vulnerability source#645
DmitriyLewen wants to merge 9 commits intoaquasecurity:mainfrom
DmitriyLewen:feat/photon-oval

Conversation

@DmitriyLewen
Copy link
Contributor

Summary

Adds a new vulnerability source photon-oval that consumes Photon OS OVAL
advisory files (photon-oval/{version}/{PHSA-ID}.json) produced by
vuln-list-update (see aquasecurity/vuln-list-update#408).

What's new

  • pkg/vulnsrc/photon-oval/ — new VulnSrc implementation:
    • Walks photon-oval/**/*.json, extracts OS version from the path segment
    • Parses affected packages from the OVAL Criteria tree
      ("{pkg} is earlier than 0:{ver}" criterion comments)
    • Stores per-CVE advisory details, vulnerability details and IDs in BoltDB
      using the existing Photon bucket
    • Maps OVAL severity (Critical / Important / Moderate / Low) to db.Severity
  • Registered in vulnsrc.All and vulnerability.AllSourceIDs

Notes

  • Lives in parallel with the existing photon source — no existing logic touched
  • OS version is taken from the file path, not from the JSON payload
  • Advisory is stored per-CVE (one PHSA → N CVE records)

Related

Test plan

  • go test ./pkg/vulnsrc/photon-oval/... passes
  • go build ./... passes
  • Manual check with a real vuln-list snapshot

Implements pkg/vulnsrc/photon-oval — a new vulnerability source that
consumes photon-oval/{version}/{PHSA-ID}.json files produced by
vuln-list-update (see aquasecurity/vuln-list-update#408).

- Walk photon-oval/**/*.json; extract OS version from path segment
- Parse affected packages from OVAL Criteria tree by matching
  "{pkg} is earlier than 0:{ver}" criterion comments
- Store per-CVE advisory details, vulnerability details, and IDs
  in BoltDB using the existing Photon bucket
- Map OVAL severity (Critical/Important/Moderate/Low) to db.Severity
- Register PhotonOVAL source in vulnsrc.All and vulnerability.AllSourceIDs
- TestVulnSrc_Update: happy path covering two OS versions (4.0, 5.0),
  sad paths for missing directory and malformed JSON
- TestVulnSrc_Get: happy path, no-match, and unmarshal error cases
- Testdata: PHSA-2023-5001 (Photon 5.0, libcap, Important),
  PHSA-2023-4001 (Photon 4.0, curl, Moderate), bad JSON fixture
@DmitriyLewen DmitriyLewen self-assigned this Mar 4, 2026
…update format

Rename PHSA-YYYY-NNNN.json → PHSA-YYYY-{osVer}-{advisory_number}.json
to match the naming scheme produced by vuln-list-update
(see aquasecurity/vuln-list-update#408).
…dorID

The PHSA advisory ID (e.g. "PHSA-2023-5.0-20") is derived from the JSON
filename, which is constructed by vuln-list-update when converting OVAL XML
to JSON (see aquasecurity/vuln-list-update#408). Store it in Advisory.VendorIDs
so that Trivy can surface the original advisory reference.
…ith photon source

Introduce ecosystem.PhotonOVAL and bucket.NewPhotonOVAL producing bucket
names "Photon OS OVAL {ver}", separate from photon's "Photon OS {ver}".
This prevents advisory-detail and data-source key collisions when both
sources run together.
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.

1 participant