Skip to content

Add Trivy security scan workflow and README badge - #927

Merged
KrzysztofPajak merged 1 commit into
developfrom
feature/trivy-pipeline
Oct 16, 2026
Merged

KrzysztofPajak merged 1 commit into
developfrom
feature/trivy-pipeline

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Type: feature

Issue

The repository has CodeQL for the C# source, but nothing checks third-party dependencies (NuGet, npm) or the published Docker image for known vulnerabilities, and the README has no badge for it.

Solution

New workflow .github/workflows/trivy.yml with two parallel jobs:

  • Scan repository – trivy fs: NuGet (Directory.Packages.props), npm (package-lock.json of vueapp and adminapp), Dockerfile misconfiguration, committed secrets.
  • Scan Docker image – builds the image from Dockerfile (no push) and runs trivy image on OS packages and the published app.

Each job runs Trivy twice:

  1. full report as SARIF, uploaded to Security → Code scanning (categories trivy-fs, trivy-image); never fails the job,
  2. gate: fails only on fixable HIGH/CRITICAL findings – this is what the badge shows.

Triggers: push to main/develop, PRs to develop, weekly cron (new CVEs appear without commits), manual dispatch. Workflow permissions default to none; jobs get contents: read + security-events: write. All actions are pinned to commit SHAs. SARIF upload is skipped for fork PRs (read-only token).

README: Trivy badge next to CodeQL, for develop.

Expected state after merge: the repository job is red. Trivy 0.70.0 run locally reports System.Security.Cryptography.Xml 10.0.12 with three HIGH CVEs (CVE-2026-96958/96959/96960), fixed in 10.0.13. The package bump comes in a separate PR, after which the badge turns green. The image job has not run yet and may report additional findings.

Breaking changes

None.

Testing

  1. actionlint 1.7.7 on the workflow – no findings.
  2. Locally: trivy fs --scanners vuln,misconfig,secret --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 . – exit 1, the three findings above; npm and Dockerfile clean.
  3. On this PR: check the Trivy run – both jobs execute, SARIF results show up under Security → Code scanning with the trivy-fs / trivy-image categories.

Scans the repository (NuGet, npm, Dockerfile, secrets) and the built
Docker image with Trivy. Every finding is uploaded as SARIF to code
scanning; the job fails only on fixable HIGH and CRITICAL findings, so
the badge shows whether a known fix is waiting to be applied. A weekly
run keeps the badge current as new CVEs are published.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 19:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@KrzysztofPajak
KrzysztofPajak merged commit f70fb49 into develop Oct 16, 2026
7 of 9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the feature/trivy-pipeline branch October 16, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants