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.tomldescription, if any. - licences
-
Declared licences from the root
gleam.tomllicencesarray. - repository
-
Project source URL (e.g. derived from a
repositorygithub 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
-
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), )Arguments
- vulnerabilities
-
Vulnerabilities to embed (CycloneDX
vulnerabilities); empty omits it. - license_texts
-
Canonical SPDX text by licence ID; empty preserves the default output.
How the BOM serialNumber is produced.
pub type SerialNumber {
FixedSerial(String)
ContentDerivedSerial
}
Constructors
-
FixedSerial(String)Use this exact
urn:uuidstring (a random v4 in normal runs). -
ContentDerivedSerialDerive a deterministic
urn:uuidfrom 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 spdx_license_id(raw: String) -> Result(String, Nil)
Canonical SPDX identifier, without CycloneDX 1.6’s schema restrictions.
pub fn try_render(
input: SbomInput,
) -> Result(String, error.Error)
Render components and graph edges, including validated local sources.
pub fn validate_graph(
locked: manifest.SbomManifest,
) -> Result(Nil, error.Error)
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.