Generate and check a local SBOM with Syft before an artifact leaves CI
An SBOM is only useful if it describes the directory or image that the release process is about to publish. Generating one after an artifact has moved to another job, registry, or environment can leave a gap: the report may be well formed, but it may no longer identify the bytes that deployment will use.
This guide uses Syft 1.51.0 to scan a local build directory, write both CycloneDX JSON and SPDX JSON, and check the resulting inventory before a later CI step uploads the artifact. The completed result is a small fail-closed shell boundary: it verifies the downloaded Syft archive, generates two machine-readable SBOM formats from a named directory, and stops if the expected package is absent. The example scans a disposable directory on the runner. It does not contact a registry, Docker daemon, cluster, or production system.