Skip to content

ci: add DockSec container scan with SARIF upload - #1789

Open
advaitpatel wants to merge 4 commits into
hyperledger-firefly:mainfrom
advaitpatel:ci/docksec-sarif-scan
Open

advaitpatel wants to merge 4 commits into
hyperledger-firefly:mainfrom
advaitpatel:ci/docksec-sarif-scan

Conversation

@advaitpatel

@advaitpatel advaitpatel commented Sep 21, 2026 •

Copy link
Copy Markdown

Proposed changes

Adds a GitHub Actions workflow that scans the Dockerfile with
DockSec 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 Dockerfile at 42.5/100
across 17 findings, and four of them are Hadolint errors rather than style advice:

DL3020 error    lines 30, 32, 44, 56  Use COPY instead of ADD for files and folders
SC2261 error    line 17               Multiple redirections compete for stdout
DL3018 warning  line 17               Pin versions in apk add
DL3029 warning  line 36               Do not use --platform flag with FROM

ADD is the one worth a look: unlike COPY it auto-extracts archives and
accepts remote URLs, so it is a wider surface than those four lines need.
SC2261 on line 17 is a correctness bug rather than a security one - competing
stdout redirections mean one silently wins.

No issue is linked. This is a small CI-only addition, but I am happy to open an
issue first and let you confirm the approach if that is the process you prefer.

Fixes #


Types of changes

  • Other: CI / build tooling

Please make sure to follow these points

  • I have read the contributing guidelines.
  • I have performed a self-review of my own work.
  • My changes generate no new warnings (workflow passes actionlint).
  • I have added tests - N/A, this adds no application code.
  • Code coverage - N/A for a CI workflow.

Other Information

Scope notes:

  • Runs scan_only, so no API key and no AI calls: fully local to the runner.
  • Does not gate merges. No fail_on, so the job reports and never fails a build.
  • Scans the Dockerfile only; it does not pull or build an image. Adding image:
    to the same step enables that later if you want it.
  • All three actions are pinned to a commit SHA.

Disclosure: I used an AI assistant (Claude) to draft this description and generate
the workflow file from DockSec's documented Action inputs. The scan results quoted
above are from runs I did myself; the workflow passes actionlint and I verified its
SARIF output against the published DockSec container before opening this.

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 either way.

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>
@advaitpatel
advaitpatel requested a review from a team as a code owner September 21, 2026 07:03
advaitpatel and others added 3 commits September 21, 2026 12:04
…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>
This repository has no Containerfile, so the trigger path was dead weight -
worse than harmless, since a repo that DOES add one later would get a green
scan run that never actually reads it (dockerfile: is a fixed string pointing
at Dockerfile). Caught by CodeRabbit on the OpenCRE PR; same bug class as the
earlier persist-credentials/fork-SARIF fixes, just the half that survived
that pass because I hadn't checked whether the repo actually had one.

Signed-off-by: Advait Patel <advaitpa93@gmail.com>
@advaitpatel

Copy link
Copy Markdown
Author

Hi @EnriqueL8 can I please get your review here? Happy to share more about the tool if needed. Thanks!

This branch has not been deployed

No deployments
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.

1 participant