Skip to content

fix(security): devops scan sbom is produced by trivy's cyclonedx and spdx writers #1439

Closed

Description

@dan-petty

Problem

Lines cited at 05e9388 (release/v0.2.29).

  • Both formats are hand-written and unvalidated. generate_cyclonedx_sbom and generate_spdx_sbom (security/sbom.py:86-194) build CycloneDX 1.5 and SPDX documents as dicts. Nothing validates them against either schema.
  • The inventory can describe the wrong software.
    • extract_workspace_components (:41) reads uv.lock when the target has one.
    • Otherwise it falls back to importlib.metadata.distributions() (:68-81): the packages of the running devops-cli environment, not of the scanned target.
    • A target without uv.lock (any non-Python project) therefore gets an SBOM of devops-cli itself.
  • The SPDX namespace can read None. It uses the project_version argument instead of the resolved version (:187; effective_version is computed at :139). devops scan sbom passes no version (commands/scan.py:516, :518), so the namespace reads devops-cli-None-<timestamp>.
  • SPDX ids can be invalid. They come from raw package names (:157), which may hold characters the SPDXRef- idstring does not allow.

Proposed remedy

  • Generate with Trivy. devops scan sbom runs trivy fs --format cyclonedx or --format spdx-json over the target, through the scanner base. Trivy is already the scan's vulnerability scanner.
    • A missing binary reports "not installed".
    • The tool's output is written unchanged.
  • Delete the hand-built documents and extract_workspace_components.

Key questions

  • Is an SBOM without Trivy needed? (proposed) No. Trivy is already required by devops scan. If a Python-only path is wanted later, cyclonedx-python-lib (CycloneDX; 11.12.0) is the library to use, not hand-built dicts.

Acceptance criteria

  • The command's argv for each format matches the Trivy invocation above (process fake), and the recorded output is written unchanged to --output.
  • A missing trivy reports "not installed" with a non-zero exit.
  • security/sbom.py no longer builds CycloneDX or SPDX dicts.
  • Tests run offline with fakes only at process and HTTP edges; each new test runs under 1 s.
  • uv run devops ci passes.

Related: #1146, #1332, #438.

Found by the 2026-10-08 client-library audit.

Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.

Activity

  1. added
    type/bug
    scope/security
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. A security tool producing incorrect or invalid SBOM output is a significant integrity defect, but it is not an actively exploitable vulnerability and Trivy is already required for the scan path.
    • Value: High. SBOMs are the primary artifact for supply-chain security compliance; an incorrect or invalid SBOM misleads every downstream consumer.
    • Effort: Medium. The fix replaces hand-built dict generation with Trivy CLI invocations, deletes the old code path, and adds process-fake tests, but Trivy is already a scan dependency so no new integration is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope/securitysource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions