No description
Find a file
2026-11-11 13:31:52 +01:00
action.yml feat(sbom): add strip-cpes to match findings by purl only 2026-11-11 13:31:52 +01:00
README.md feat(sbom): add strip-cpes to match findings by purl only 2026-11-11 13:31:52 +01:00
renovate.json feat(sbom): add sbom action with dependency-track workload identity upload 2026-11-10 16:07:06 +01:00

sbom

Forgejo Action that generates a CycloneDX SBOM with Syft, uploads it to Dependency-Track and optionally fails on Grype findings. The upload authenticates through Dependency-Track's workload identity federation (5.2.0 or later): the job's Forgejo ID token is exchanged for a short-lived session, so no Dependency-Track API key is stored anywhere.

jobs:
  build:
    runs-on: ubuntu-latest
    enable-openid-connect: true
    steps:
      # ... build and push the image ...

      - uses: https://git.tweecore.cloud/actions/sbom@v1.1.0
        with:
          target: registry:${{ steps.image.outputs.image }}:${{ steps.image.outputs.version }}
          registry: ${{ vars.REGISTRY }}
          registry-username: ${{ secrets.REGISTRY_USER }}
          registry-password: ${{ secrets.REGISTRY_PASSWORD }}
          project-name: ${{ github.repository }}
          project-version: ${{ github.ref_name }}
          dtrack-url: ${{ vars.DTRACK_URL }}
          upload: ${{ github.ref_type == 'tag' && vars.DTRACK_URL != '' }}
          is-latest: ${{ github.ref_type == 'tag' }}
          fail-on: critical

enable-openid-connect has to be set by the calling workflow or job; a composite action cannot turn it on. Syft and Grype run as docker:// steps, so the runner has to support Docker actions. Syft runs in its own container and does not see a docker login of the job, so a private registry: target needs the credentials passed in.

Input Default
target dir:. Syft source
registry Registry authority of a registry: target
registry-username Username for that registry
registry-password Password for that registry
project-name Dependency-Track project name
project-version Dependency-Track project version
dtrack-url Base URL, also the OIDC audience
workload-identity-provider git-tweecore-cloud Provider name in Dependency-Track
service-account git.tweecore.cloud Service account bound to the provider
upload true false only generates and gates
is-latest false Marks the version as latest
fail-on Grype severity gate, empty disables it
strip-cpes false Removes the guessed CPEs, needs jq

Syft guesses a CPE for every package, and a CPE carries vendor and product but no ecosystem: Dependency-Track then matches the NVD entries of C++, Java and Python protobuf against Go's google.golang.org/protobuf. With strip-cpes: true only the purl is left, and findings come from the sources that match by package, OSV and GitHub Advisories, which have to be enabled in Dependency-Track.

The SBOM is written to sbom.cdx.json in the workspace; the output sbom is its path, for example to attach it as a release asset.

Updating Syft and Grype

Both images are pinned by tag and digest in action.yml. Renovate updates them once a release is 14 days old.