anchorectl sbom
Sign, verify and attest local SBOM files using cosign.
These commands run the cosign binary (v3.0.4 or later) found on your PATH, or the one named by the ANCHORECTL_COSIGN_PATH environment variable when that is set. ANCHORECTL_COSIGN_PATH takes the full path of the cosign binary; it is an environment variable only, with no configuration-file setting or flag. If it is set but does not point at an executable cosign, the command fails rather than falling back to PATH. They work on files on disk only: they do not contact Anchore Enterprise and do not push anything to a registry. For a walkthrough, see Sign and Attest SBOMs.
Every command on this page also accepts the global flags. Signing settings can also come from the cosign section of the configuration file; a flag on the command line takes precedence.
Supported SBOM formats: CycloneDX JSON, SPDX JSON and Syft JSON.
Subcommands
- sbom sign — Sign an SBOM file with cosign
- sbom verify — Verify an SBOM file’s signature or attestation with cosign
- sbom attest — Attest that an SBOM describes a file, signed with cosign
sbom sign
Sign an SBOM file on disk with cosign and write a Sigstore signature bundle next to it (SBOM.sigstore.json, or --bundle). The SBOM file itself is not modified.
anchorectl sbom sign SBOM [flags]
Arguments
| Argument | Description |
|---|---|
SBOM | Path to the SBOM file to sign. |
Flags
| Flag | Type | Environment variable | Default | Required | Description |
|---|---|---|---|---|---|
--key | string | ANCHORECTL_COSIGN_KEY | "" | One of --key / --keyless | Private key: a file path or a KMS URI (awskms://, gcpkms://, azurekms://, hashivault://). |
--keyless | bool | ANCHORECTL_COSIGN_KEYLESS | false | One of --key / --keyless | Sign with a short-lived certificate from an OIDC login instead of a key. Needs --tlog-upload=true. |
--bundle | string | SBOM.sigstore.json | No | File to write the Sigstore bundle to. | |
--overwrite | bool | false | No | Overwrite the bundle file if it already exists. | |
--tlog-upload | bool | ANCHORECTL_COSIGN_TLOG_UPLOAD | true | No | Record the signature in the Rekor transparency log. Set false to sign fully offline. |
The key password is read from cosign.password in the configuration file, ANCHORECTL_COSIGN_PASSWORD or COSIGN_PASSWORD. There is no password flag. If none is set, cosign prompts for it.
sbom verify
Check the Sigstore bundle for an SBOM file with cosign and print one line: the signature (or, with --attestation, the attestation) is valid, or it is not. The exit code is 0 only when the check passes.
anchorectl sbom verify SBOM [flags]
Arguments
| Argument | Description |
|---|---|
SBOM | Path to the SBOM file to verify. |
Flags
| Flag | Type | Environment variable | Default | Required | Description |
|---|---|---|---|---|---|
--key | string | ANCHORECTL_COSIGN_PUBLIC_KEY | "" | One of --key / --certificate-* | Public key: a file path or a KMS URI. Read from cosign.public-key in the configuration file. |
--certificate-identity | string | ANCHORECTL_COSIGN_CERTIFICATE_IDENTITY | "" | With keyless | Identity a keyless signature must carry. |
--certificate-oidc-issuer | string | ANCHORECTL_COSIGN_CERTIFICATE_OIDC_ISSUER | "" | With keyless | OIDC issuer a keyless signature must carry. |
--bundle | string | SBOM.sigstore.json; with --attestation, SBOM.att.sigstore.json | No | Sigstore bundle to check. | |
--attestation | bool | false | No | Verify an attestation about the SBOM instead of a signature of the SBOM itself. | |
--subject | string | "" | With --attestation | The file the SBOM describes, which the attestation is bound to. | |
--type | string | detected | No | With --attestation: the attestation type (cyclonedx, spdxjson, custom or an absolute URI). Detected from the SBOM file when omitted. | |
--tlog-upload | bool | ANCHORECTL_COSIGN_TLOG_UPLOAD | true | No | Check the Rekor transparency log entry. Set false to verify a bundle that was signed offline. |
With --attestation, anchorectl also checks that the SBOM stored in the attestation is the SBOM file you passed. If the attestation is valid but describes a different SBOM, verification fails.
sbom attest
Create a signed cosign attestation that a file (the subject, named with --subject) is described by the given SBOM, and write a Sigstore attestation bundle next to the SBOM (SBOM.att.sigstore.json, or --bundle). Neither the SBOM nor the subject file is modified.
anchorectl sbom attest SBOM --subject FILE [flags]
Arguments
| Argument | Description |
|---|---|
SBOM | Path to the SBOM file to use as the attestation predicate. |
Flags
| Flag | Type | Environment variable | Default | Required | Description |
|---|---|---|---|---|---|
--subject | string | "" | Yes | The file the SBOM describes, which the attestation is bound to. | |
--key | string | ANCHORECTL_COSIGN_KEY | "" | One of --key / --keyless | Private key: a file path or a KMS URI. |
--keyless | bool | ANCHORECTL_COSIGN_KEYLESS | false | One of --key / --keyless | Sign with a short-lived certificate from an OIDC login instead of a key. Needs --tlog-upload=true. |
--type | string | detected | No | The attestation type (cyclonedx, spdxjson, custom or an absolute URI). Detected from the SBOM file when omitted: CycloneDX → cyclonedx, SPDX → spdxjson, Syft → https://syft.dev/bom. | |
--bundle | string | SBOM.att.sigstore.json | No | File to write the Sigstore bundle to. | |
--overwrite | bool | false | No | Overwrite the bundle file if it already exists. | |
--tlog-upload | bool | ANCHORECTL_COSIGN_TLOG_UPLOAD | true | No | Record the attestation in the Rekor transparency log. Set false to attest fully offline. |