Repository navigation
ci: add DockSec container scan with SARIF upload - #5689
advaitpatel wants to merge 2 commits into
Conversation
Scans the Dockerfile with DockSec and uploads the results to code scanning as SARIF, so container findings are annotated on pull requests. Runs scan-only, so no API key is required and no gate is added to the build. All actions are pinned to a commit SHA. Signed-off-by: Advait Patel <advaitpa93@gmail.com>
mtardy
left a comment
There was a problem hiding this comment.
Hey, I don't think we particularly want a new workflow to run your tool in the CI, on the other hand, if you want to propose fixes for the things it detected (when running locally) and they make sense we'll be happy to review them. Thanks.
…IF upload The path filter matched nested Dockerfile/Containerfile variants but the scan itself only ever reads the root Dockerfile, so a change to a nested file would trigger a green run that scanned nothing relevant - worse than no scan, since it reads as coverage that isn't there. Narrowed the trigger to match what is actually scanned. checkout now sets persist-credentials: false; nothing after it needs the token in git config, and the next step runs third-party actions. The SARIF upload no longer runs unconditionally on fork pull requests. GITHUB_TOKEN is read-only there, so security-events: write cannot apply and the upload would fail every time - turning a routine fork contribution into a red required check. It now runs on push, on same-repo PRs, and on schedule, and is skipped on fork PRs. Thanks to a reviewer on an earlier PR for catching all three. Signed-off-by: Advait Patel <advaitpa93@gmail.com>
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Understood, thanks for the quick answer. Closing this rather than leaving it open against your wishes. If it's useful: the DockSec scan found 15 Dockerfile findings when I ran it locally, the largest cluster being 20 instances of DL3020 (using ADD where COPY would do - none of the file's ADD instructions pull a remote URL or extract an archive, so COPY covers the same job with less capability than needed). Happy to open a separate PR fixing just that pattern if it's useful, with no workflow attached - your call, no worries either way if not. |
|
Closing per the maintainer's note above - not something they want in CI right now. |
Fixes
Description
Adds a GitHub Actions workflow that scans the
DockerfilewithDockSec and uploads the results to code
scanning as SARIF, so container findings are annotated inline on pull requests.
DockSec is an OWASP Lab Project (MIT). It wraps Hadolint and Trivy and reports
Dockerfile misconfigurations and image CVEs through a single SARIF upload.
Why this repository: DockSec scores the current
Dockerfileat 37.5/100,the lowest of the repositories I checked, across 15 findings:
The unpinned
apt-getandapk addon lines 15 and 35 are the substantive onesfor a security-focused project: an unpinned package install means two builds of
the same commit can produce different binaries.
The base images are already SHA-pinned, which keeps the image-layer CVE surface
low, so most of the value here is the Dockerfile layer plus the weekly re-scan
that catches newly disclosed CVEs without a code change.
Scope notes:
scan_only, so no API key and no AI calls: fully local to the runner.fail_on, so the job reports and never fails a build.Adding
image:to the same step enables that later if you want it.security-events: writeisscoped to the single job that needs it.
Changelog
Disclosure, per https://github.com/cilium/community/blob/main/AI-POLICY.md: I
used an AI assistant (Claude) to draft this PR description and to generate the
workflow file from DockSec's documented Action inputs. I ran the scan results
quoted above myself, validated the workflow with
actionlint, and verified theSARIF output against the published DockSec container before opening this. I
understand the change and take responsibility for it.
Disclosure of interest: I am the project lead for DockSec, the tool this
workflow adds. Happy to close this if it is not a fit - no hard feelings.