pub struct CycloneDxSbom {
pub bom_format: String,
pub spec_version: String,
pub serial_number: String,
pub version: u32,
pub metadata: SbomMetadata,
pub components: Vec<Component>,
pub dependencies: Vec<Dependency>,
}Expand description
A complete CycloneDX 1.5 SBOM document.
Field names use #[serde(rename_all = "camelCase")] to match the
CycloneDX JSON schema (bomFormat, specVersion, serialNumber, …).
Fields§
§bom_format: StringAlways the literal string "CycloneDX".
spec_version: StringCycloneDX spec version — "1.5".
serial_number: Stringurn:uuid:... serial number, derived from the output ELF digest.
version: u32Document revision; 1 for a freshly emitted SBOM.
metadata: SbomMetadataBuild metadata: timestamp + the synth compiler tool entry.
components: Vec<Component>Components: the input WASM, the output ELF, and one per WASM import.
dependencies: Vec<Dependency>Dependency graph linking the output ELF to its inputs.
Implementations§
Source§impl CycloneDxSbom
impl CycloneDxSbom
Sourcepub fn new(inputs: &SbomInputs<'_>, timestamp: String) -> Self
pub fn new(inputs: &SbomInputs<'_>, timestamp: String) -> Self
Build a CycloneDX 1.5 SBOM describing one synth compilation.
timestamp is the RFC-3339 UTC string for metadata.timestamp; the
caller supplies it so tests can pin a fixed value and production code
can pass now_rfc3339.
Sourcepub fn with_build_environment(self, vars: &[(String, String)]) -> Self
pub fn with_build_environment(self, vars: &[(String, String)]) -> Self
Serialise to pretty-printed CycloneDX 1.5 JSON.
#1293: record the byte-changing build environment. vars are
(NAME, value) pairs; only SYNTH_* names are kept, sorted, so the
property order never depends on the order the OS returned them in.
pub fn to_json(&self) -> String
Sourcepub fn sidecar_path(elf_path: &Path) -> PathBuf
pub fn sidecar_path(elf_path: &Path) -> PathBuf
Compute the SBOM path next to an output ELF: replaces the file
extension with .cdx.json (the conventional CycloneDX-JSON suffix).
Examples:
foo.elf->foo.cdx.jsonout->out.cdx.json