Plans: Every plan. Who: an owner or admin creates the API token; anyone who can edit the repository’s workflows adds the step.
anchore/sbom-action (Syft) whenever you publish a release, and sends it to Pharus. It is the same workflow as the GitHub Actions tab of Connect a pipeline on the SBOMs page.
Before you start
1
Create a token
In Pharus, go to Settings → API tokens and create a token for the product family. See create a token.
2
Store it as a secret
In GitHub, open the repository’s Settings → Secrets and variables → Actions and add a repository secret named
PHARUS_TOKEN with the token as its value.The workflow
Save this as.github/workflows/pharus-sbom.yml:
- Trigger: every published release, and by hand from the Actions tab (
workflow_dispatch). - Generate:
anchore/sbom-actionruns Syft on the checked-out repository and writessbom.cdx.json. - Version: the release tag becomes the product version in Pharus. A run started by hand uses the branch or tag name.
- Send: the step gzips the file and posts it to
POST /api/v1/sboms. TheX-Pharus-*headers fill in the Pipeline card on the SBOM’s page, with a link back to the run. - Fail loudly:
--fail-with-bodyfails the step on any error and prints Pharus’ message in the log.
Variations
Send SPDX instead of CycloneDX
Send SPDX instead of CycloneDX
Set
format: spdx-json and output-file: sbom.spdx.json on anchore/sbom-action, and gzip sbom.spdx.json in the last step. Pharus reads SPDX JSON 2.2 and 2.3.Scan a container image
Scan a container image
Add
image: with the image reference to anchore/sbom-action, for example image: ghcr.io/acme/gateway-g3:4.2, to describe the image instead of the source tree.Already using sbomify-action
Already using sbomify-action
sbomify-action saves the SBOM it uploads as
sbom_output.json. Add the Send SBOM to Pharus step after it, with gzip -c sbom_output.json and X-Pharus-Source: sbomify. The sbomify tab of Connect a pipeline has the step ready to copy.Check that it worked
A successful run logs Pharus’ answer, for example:"duplicate":true.
If the step fails, the log shows the error code. The most common:
All codes are listed under errors.