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),
  )
}

Constructors

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),
    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 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 try_render(
  input: SbomInput,
) -> Result(String, error.Error)

Returns the rendered JSON, or an Error if any entry has an unsupported source for purl generation.

✨ Search Document