Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/self-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:

self-scan-action:
runs-on: ubuntu-latest
permissions:
security-events: write

steps:
- name: Checkout
Expand Down
28 changes: 19 additions & 9 deletions website/docs/sarif.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,30 @@ cve-lite . --sarif --json
Upload the SARIF file to GitHub's Security tab using the official action:

```yaml
- name: Scan dependencies
run: cve-lite . --sarif

- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: ${{ github.workspace }}
jobs:
scan:
runs-on: ubuntu-latest
permissions:
security-events: write # required for upload-sarif
steps:
- uses: actions/checkout@v4

- name: Scan dependencies
run: cve-lite . --sarif

- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: ${{ github.workspace }}
```

Findings appear in the **Security → Code scanning** tab and as PR annotations.

:::tip
Use `if: always()` on the upload step. Without it, the upload is skipped when `--fail-on` causes a non-zero exit — which means you'd lose the findings in Code Scanning exactly when they matter most.
`security-events: write` is a GitHub platform requirement for any workflow that uploads to Code Scanning — it must be declared on the job, not inside the action.

Use `if: always()` on the upload step so findings are uploaded even when `--fail-on` causes a non-zero exit.
:::

## What the SARIF file contains
Expand Down
32 changes: 20 additions & 12 deletions website/docs/workflow-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,29 @@ This repository also uses CVE Lite CLI in its own CI to scan itself. See [`self-
Add `sarif: "true"` and an upload step to surface findings in the **Security → Code scanning** tab and as PR annotations:

```yaml
- uses: actions/checkout@v6
- uses: OWASP/cve-lite-cli@v1
with:
fail-on: high
sarif: "true"

- name: Upload to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: ${{ github.workspace }}
jobs:
scan:
runs-on: ubuntu-latest
permissions:
security-events: write # required for upload-sarif
steps:
- uses: actions/checkout@v6
- uses: OWASP/cve-lite-cli@v1
with:
fail-on: high
sarif: "true"

- name: Upload to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: ${{ github.workspace }}
```

:::tip
`if: always()` is required on the upload step. Without it, the upload is skipped when `--fail-on` causes a non-zero exit — losing your findings in Code Scanning exactly when they matter most.
`security-events: write` is a GitHub platform requirement for any workflow that uploads to Code Scanning — it must be declared on the job, not inside the action.

Use `if: always()` on the upload step so findings are uploaded even when `--fail-on` causes a non-zero exit.
:::

---
Expand Down