licence_audit/sbom

Types

An OSV advisory paired with the component bom-refs (purls) it affects, ready to be emitted into the CycloneDX vulnerabilities array. An empty list of these on SbomInput omits the array entirely.

pub type EmbeddedVulnerability {
  EmbeddedVulnerability(
    vuln: osv.Vulnerability,
    affects: List(String),
    purls: List(String),
  )
}

Constructors

  • EmbeddedVulnerability(
      vuln: osv.Vulnerability,
      affects: List(String),
      purls: List(String),
    )

    Arguments

    purls

    OSV query identities can differ from local bom-refs.

pub type LicenseEntry {
  LicenseId(id: String)
  LicenseName(name: String)
  LicenseExpression(expression: String)
}

Constructors

  • LicenseId(id: String)
  • LicenseName(name: String)
  • LicenseExpression(expression: String)
pub type RootComponent {
  RootComponent(
    name: String,
    version: String,
    description: option.Option(String),
    licences: List(String),
    repository: option.Option(String),
  )
}

Constructors

  • RootComponent(
      name: String,
      version: String,
      description: option.Option(String),
      licences: List(String),
      repository: option.Option(String),
    )

    Arguments

    description

    Project summary from the root gleam.toml description, if any.

    licences

    Declared licences from the root gleam.toml licences array.

    repository

    Project source URL (e.g. derived from a repository github table).

pub type SbomInput {
  SbomInput(
    manifest: manifest.SbomManifest,
    root: RootComponent,
    tool_version: String,
    serial_number: SerialNumber,
    timestamp: String,
    package_metadata: dict.Dict(String, hex.PackageMetadata),
    publications: dict.Dict(String, hex.Publication),
    scopes: dict.Dict(String, manifest.Scope),
    vulnerabilities: List(EmbeddedVulnerability),
    license_texts: dict.Dict(String, String),
  )
}

Constructors

How the BOM serialNumber is produced.

pub type SerialNumber {
  FixedSerial(String)
  ContentDerivedSerial
}

Constructors

  • FixedSerial(String)

    Use this exact urn:uuid string (a random v4 in normal runs).

  • ContentDerivedSerial

    Derive a deterministic urn:uuid from a hash of the BOM content, so the same content and timestamp always yield the same serial number.

Values

pub fn component_ref(
  entry: manifest.SbomEntry,
) -> Result(String, error.Error)

Local references identify metadata within this BOM, not a publication.

pub fn license_entries(
  licences: List(String),
) -> List(LicenseEntry)

Map a single compound SPDX declaration to an expression choice. Otherwise emit one licence entry per declaration. Multiple declarations remain separate: Hex does not record whether the relationship is conjunctive (“AND”) or disjunctive (“OR”), so we do not synthesise an SPDX expression that would assert an operator we cannot verify.

pub fn purl_for(
  entry: manifest.SbomEntry,
) -> Result(String, error.Error)
pub fn resolve_local(
  locked: manifest.SbomManifest,
  project_root: String,
) -> Result(
  #(manifest.SbomManifest, dict.Dict(String, hex.PackageMetadata)),
  error.Error,
)

Validate current local metadata against the locked graph. Returned paths are normalized relative to the manifest directory, never the checkout root.

pub fn try_render(
  input: SbomInput,
) -> Result(String, error.Error)

Render components and graph edges, including validated local sources.

pub fn verified_purl(
  entry: manifest.SbomEntry,
  publications: dict.Dict(String, hex.Publication),
) -> Result(option.Option(String), error.Error)

A verified publication can add a purl without changing local provenance. This identity rule is shared by SBOM formats and vulnerability enrichment.

✨ Search Document