GitHub Actions SARIF security audit

Run the official websecaudit/website-vulnerability-scanner@v0.2.1 composite Action against preview or staging URLs and surface findings directly under the repository Security tab.

Copy-paste GitHub Workflow with Code Scanning upload

name: Website Security Audit
on:
  schedule:
    - cron: "0 6 * * 1"
  workflow_dispatch:

jobs:
  web-audit:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      contents: read
    steps:
      - uses: actions/checkout@v4

      - name: Run website and API audit
        uses: websecaudit/website-vulnerability-scanner@v0.2.1
        with:
          target: https://example.com
          profile: web
          openapi: ""
          sarif: web-audit.sarif
          fail-on: high
          max-requests: "120"

      - name: Upload SARIF to GitHub Code Scanning
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: web-audit.sarif

Deterministic SARIF fingerprints

Each exported SARIF result carries a deterministic partialFingerprints value computed by compute_fingerprint from rule ID, normalized path, and issue evidence. Re-running the workflow updates open alert states cleanly without creating duplicate alerts on every commit.

Frequently asked questions

Why use if: always() on the upload-sarif step?

When --fail-on triggers exit code 2, subsequent steps normally stop. Adding if: always() ensures GitHub still receives the SARIF report so developers see the alert details inside the Security tab.

Does the Action work on private repositories?

Yes, for public repos and GitHub Advanced Security repos. On private repos without Advanced Security, output HTML, Markdown, or JSON reports as workflow artifacts instead of calling upload-sarif.

Related guides

Baseline diffing in CI pipelines

Fail builds only on new or worsened findings with --baseline and --fail-on-regression.

OpenAPI and REST API scanner

Pass openapi and rules inputs directly to the GitHub Action.

CLI reference and comparison

See all exit codes and Docker headless invocation options.