# `VulnCheck.Report.CycloneDX`
[🔗](https://github.com/Voskan/vulncheck/blob/v1.0.1/lib/vulncheck/report/cyclonedx.ex#L1)

CycloneDX 1.6 JSON bill of materials (`--sbom` or `--format cyclonedx`).

Lists every locked package with its package URL, scope (`required` for
the production closure, `excluded` otherwise) and lockfile checksum, the
dependency graph, and the matched advisories with a CycloneDX `analysis`
block derived from the reachability verdict.

Output is reproducible: the timestamp is the report's `generated_at` and
the serial number is derived from the document content, unless they are
given with the `:timestamp` and `:serial_number` options.

# `analysis`

```elixir
@spec analysis(VulnCheck.Types.Finding.t()) :: map()
```

CycloneDX analysis block of a finding.

# `component_refs`

```elixir
@spec component_refs(VulnCheck.Types.Workspace.t() | nil) :: %{
  required(String.t()) =&gt; String.t()
}
```

References of locked components, including distinct lock aliases of the same package.

# `document`

```elixir
@spec document(VulnCheck.Types.ScanReport.t(), VulnCheck.Config.t(), keyword()) ::
  map()
```

The bill of materials as plain maps.

# `encode`

```elixir
@spec encode(VulnCheck.Types.ScanReport.t(), VulnCheck.Config.t(), keyword()) ::
  String.t()
```

Encodes the bill of materials. Options: `:timestamp` (ISO-8601) and
`:serial_number` (`urn:uuid:...`).

# `purl`

```elixir
@spec purl(VulnCheck.Types.Package.t()) :: String.t()
```

Package URL of a locked package.

    iex> VulnCheck.Report.CycloneDX.purl(%VulnCheck.Types.Package{name: "ash", version: "3.34.2", source: :hex, scope: :prod})
    "pkg:hex/ash@3.34.2"

# `root_ref`

```elixir
@spec root_ref(VulnCheck.Types.ScanReport.t() | VulnCheck.Types.Workspace.t() | nil) ::
  String.t()
```

Reference of the scanned project and the scope of the analysis.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
