Skip to content

GitHub Actions

This workflow runs witnyx check on every push to main and on every pull request. It downloads the Linux release binary and checks it against SHA256SUMS. It keeps the public data in a cache between runs, keeps the reports as an artifact, adds the Markdown report to the run’s summary, and uploads the findings to GitHub code scanning.

Save it as .github/workflows/release-security-check.yml. It expects an earlier step of the job to write the software bill of materials (SBOM) to bom.json: build your project there and run your SBOM generator, as Your first check shows.

name: Release security check
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write # upload the SARIF report to code scanning
actions: read # the SARIF upload needs it in a private repository
env:
WITNYX_VERSION: 0.1.0
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Build your project and write its SBOM to bom.json here.
- name: Install witnyx
run: |
mkdir -p "$RUNNER_TEMP/witnyx"
cd "$RUNNER_TEMP/witnyx"
base="https://github.com/witnyx/witnyx/releases/download/v$WITNYX_VERSION"
curl -fsSLO "$base/witnyx-linux-x64"
curl -fsSLO "$base/SHA256SUMS"
sha256sum --check --ignore-missing SHA256SUMS
install -m 0755 witnyx-linux-x64 witnyx
echo "$RUNNER_TEMP/witnyx" >> "$GITHUB_PATH"
- name: Name today's data cache
id: day
run: echo "day=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Restore the data cache
id: cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/witnyx-cache
key: witnyx-data-${{ steps.day.outputs.day }}
restore-keys: witnyx-data-
- name: Release security check
run: |
witnyx check bom.json --no-agent --cache-dir "$RUNNER_TEMP/witnyx-cache" --output json=witnyx-report.json --output markdown=witnyx-report.md --output sarif=witnyx.sarif
- name: Save the data cache
if: ${{ !cancelled() && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/witnyx-cache
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Add the report to the run summary
if: ${{ !cancelled() && hashFiles('witnyx-report.md') != '' }}
run: cat witnyx-report.md >> "$GITHUB_STEP_SUMMARY"
- name: Keep the reports
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: witnyx-report
path: |
witnyx-report.json
witnyx-report.md
witnyx.sarif
retention-days: 90
- name: Upload the findings to code scanning
if: ${{ !cancelled() && hashFiles('witnyx.sarif') != '' }}
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
sarif_file: witnyx.sarif
category: witnyx

Every action is pinned to a full commit, with its version in a comment, so a moved tag cannot change what runs. Dependabot can keep the pins current.

  • Install witnyx downloads the binary of the release in WITNYX_VERSION and SHA256SUMS. sha256sum stops the job when the binary’s checksum differs from the listed one. For a stronger check, write the binary’s checksum into the workflow instead of downloading SHA256SUMS from the same place.
  • Release security check fails the job with exit code 1 when a --fail-on rule triggers, and with exit code 2 when the check cannot run. --no-agent keeps the text report in the log, whatever the job’s environment says about AI coding agents. The three --output options write the JSON, Markdown and SARIF reports.
  • The steps after it run even when the check failed the job (!cancelled()), so you always get the cache, the reports and the alerts.

Witnyx keeps the public lists it downloads in --cache-dir: CISA’s Known Exploited Vulnerabilities catalogue, ENISA’s list of exploited vulnerabilities (the source of EUVD IDs) and the end-of-life data of endoflife.date. It uses a cached copy that is less than 24 hours old, and downloads an older one again. When a download fails, it uses a cached copy up to 7 days old, and the report says so. OSV is asked on every run, and nothing from it is cached.

So freshness is Witnyx’s own decision. The date in the cache key only makes the workflow save the cache once a day: GitHub never overwrites a cache entry, and restore-keys restores the newest earlier one. How a check works describes each source.

The artifact witnyx-report keeps the three reports for 90 days. The JSON report is the record of the run: checkedAt says when the check ran, and each actively exploited finding repeats it as awareAt, the time you were made aware. Keep it as long as your own records need it, for example by copying it to your storage. Report formats describes each format.

The SARIF report turns each finding into a code scanning alert on the SBOM file, with a link to the finding’s page on this site. SARIF describes the file.

Code scanning is available for public repositories, and for private repositories of organizations that have GitHub Code Security. Without it, remove the last step and the security-events and actions permissions.

The Action witnyx/check does what the workflow above does, in one step. It downloads the release binary for the runner and checks it against the release’s signed SHA256SUMS, runs witnyx check from the workspace root, adds the Markdown report to the run’s summary, uploads the SARIF report to code scanning and keeps the reports as an artifact. witnyx init writes a workflow that uses it.

name: Release security check
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write # upload the SARIF report to code scanning
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Build your project and write its SBOM to bom.json here.
- uses: witnyx/check@e992e15adeba8b59d776729e04d4fb3b0a2ec7fe # v1.0.0
with:
sbom: bom.json

The inputs you are most likely to set:

Input Default What it does
sbom The SBOM’s path from the workspace root. Empty: witnyx check looks for one.
fail-on exploited When the job fails. The Action always passes it to witnyx check.
version latest The Witnyx release to run.
upload-sarif true Upload the SARIF report to code scanning.
args More arguments for witnyx check, split on spaces. They must not set --repo-dir.

The Action’s README lists every input and output.

Three things to know:

  • An approval is only as trustworthy as its review. A “not affected” entry in .witnyx.yml counts once a person has approved it in that file, and a pull request can change the file. Review every change to .witnyx.yml as you review code, for example with a code owner for it. The Action passes --fail-on itself, so the file cannot weaken when the job fails.
  • SARIF locations. The Action checks from the workspace root and refuses --repo-dir in args, so every location in the SARIF report is relative to the repository root, as code scanning expects. For a project in a subfolder, pass its SBOM with sbom.
  • Private repositories need GitHub Code Security for code scanning. Without it, set upload-sarif: false.

Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.