Skip to content

Bug: emit ecosystem-correct PURLs in SBOM exports #167

Open

Description

@vibgrate-team

Context

vg sbom export should not claim an ecosystem Vibgrate did not detect. If SPDX/CycloneDX helpers hard-code pkg:npm/... for non-npm packages, supply-chain evidence is wrong.

Separate from #151 (docs/example) and the outputs-contract docs issue.

What to do

  • Preserve ecosystem metadata through SBOM export
  • Emit ecosystem-correct PURLs for supported package managers
  • Use the same identity in CycloneDX and SPDX where both exist
  • If ecosystem cannot be identified safely, omit/NOASSERTION rather than guessing npm
  • Add fixtures for npm plus at least two non-npm ecosystems
  • Keep ordering and generated identifiers deterministic

Do not fabricate dependency relationships from a flat list unless the parser already exposes them.

Acceptance

  • npm packages still emit valid npm PURLs
  • Non-npm packages do not emit npm PURLs
  • Unknown ecosystems degrade honestly
  • Tests cover both formats (or document if only one ships)
  • Repeated export of a fixed artifact is byte-stable; DCO sign-off

Mentoring notes

Start from SBOM export / lockfile component helpers. fix: or feat: Conventional Commit as appropriate.

Activity

  1. added
    bug
    help wanted
    on Sep 16, 2026
  2. vibgrate-team commented on Oct 3, 2026

    @vibgrate-team
    ContributorAuthor

    Component PURLs in toCycloneDx / toSpdx go through purlFor(dep.ecosystem, …) in src/reporting/commands/sbom.ts. The dependency graph does not. cycloneDxDependencyGraph maps every lockfile key with npmPurl, and spdxRelationships keys nodes as package@version with no ecosystem. A Cargo or PyPI graph can show pkg:cargo/… on components[].purl and pkg:npm/… on dependencies[].dependsOn.

    purlPath's default branch also falls through to npm, so an unrecognized ProjectScan.type is claimed as npm.

    Scope for a fix:

    • Carry ecosystem on graph refs. The lockfile key is only name@version today; that is the gap, not purlFor itself.
    • Use the same purl string in CycloneDX bom-ref / dependencies and SPDX externalRefs.
    • If the ecosystem is unknown, omit the purl. Do not invent pkg:npm. SPDX downloadLocation: NOASSERTION can stay.
    • Fixtures: npm plus two non-npm ecosystems. Repeated export of a fixed artifact stays byte-stable.

    Leaving this open for an external contributor (help wanted).

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

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions