Skip to content

ci: add Trivy security scan uploading to the Security tab - #457

Closed
alexgleith wants to merge 1 commit into
stac-utils:mainfrom
auspatious:ci/security-scan
Closed

alexgleith wants to merge 1 commit into
stac-utils:mainfrom
auspatious:ci/security-scan

Conversation

@alexgleith

Copy link
Copy Markdown

Adds a Trivy filesystem scan (dependency vulnerabilities from uv.lock, Dockerfile/workflow misconfigurations, secrets) that uploads SARIF results to GitHub's Security tab as code scanning alerts.

Runs on pushes to main, on PRs, and weekly. Actions are SHA-pinned like the other workflows.

🤖 Generated with Claude Code

@alexgleith

Copy link
Copy Markdown
Author

Apologies for the driveby PR, but I have a project that has asked me about security vulnerabilities and I'm hoping we can lift the visibility of any outstanding vulnerabilities. I'll help work on resolving some, once we've got this merged. (Open to alternative methods!)

@lhoupert

Copy link
Copy Markdown
Collaborator

Thanks @alexgleith, and no need to apologise: the motivation makes sense! A few things came up looking at the workflow:

  • The aquasecurity/trivy-action pin a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 doesn't exist in that repository (the commit page returns 404), so as written the job would fail at setup.
  • Dependabot alerts and security updates are already enabled here and read uv.lock, transitive dependencies included. The dependency scan would mostly duplicate them, with two alerts per CVE to triage
  • Security tab alerts, from code scanning or Dependabot, are only visible to people with write access, so this wouldn't make the state any more visible to downstream users.

What neither Dependabot nor an fs scan sees is the published image's OS packages (here for example the Debian layer from python:3.14-slim). Often the base image is where you will find most vulnerabilities. If that's what your project is asking about, just running trivy image ghcr.io/stac-utils/stac-fastapi-pgstac:<tag> on your laptop gives you the full picture.

For some inspirations on how to do that in your own GitHub workflow you could look at that for example https://github.com/EOPF-Explorer/titiler-eopf/blob/9f79180266070be38c7a43648971d13c91ac7740/.github/workflows/docker-helm.yml#L89

@alexgleith

Copy link
Copy Markdown
Author
  • Security tab alerts, from code scanning or Dependabot, are only visible to people with write access

Oh, I didn't realize this and of course it makes sense. I'll close this, and consider running tests on a fork or just run local checks and propose fixes if necessary for my client.

Thanks for the feedback @lhoupert

@alexgleith alexgleith closed this Nov 18, 2026
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.

2 participants