Trivy and Semgrep put the Dockerfile root user in different classes
Maintainers usually reply within 1 day
@anushkasingh-commits is already working on this.
Since Dec 1, 2026.
- #169 by @anushkasingh-commits — open
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Read internal/seed/external.go, especially trivyPrivRe and trivyMisconfigClass, then inspect the scanner fixtures in internal/seed/testdata/real/. Update the classification so Trivy DS-0002 matches Semgrep last-user-is-root, and add or adjust TestParseRealScannerOutput in internal/seed/external_test.go. Run go test ./internal/seed; the change is complete when both scanner outputs produce the same class.
Written by the indexing model from the issue text.
Description
Summary
The same root-user flaw in a Dockerfile lands in two different classes depending on which scanner found it. Trivy's DS-0002 ("Image user should not be 'root'") becomes container-hardening, while Semgrep's last-user-is-root becomes container-privilege. Leads from the two scanners on the same line are then not merged as one finding, and the class (and its remediation text) depends on which tools are installed.
Where
internal/seed/external.go:1004(trivyPrivRe)internal/seed/external.go:1015(trivyMisconfigClass)internal/seed/testdata/real/trivy-0.76.2.jsonandsemgrep-1.187.0.json(real outputs showing both)
Details
trivyPrivRe = regexp.MustCompile(`(?i)privileged|host ?(?:network|pid|ipc|path)|capabilit|docker\.sock`)
...
case trivyPrivRe.MatchString(text):
return "container-privilege", "CWE-250"
...
return "container-hardening", "CWE-250"
DS-0002's title and message do not contain any of those words, so it falls through to container-hardening.
Impact
Duplicate findings for one flaw when both scanners run, and an inconsistent class across runs with different scanners installed.
Suggested fix
Map DS-0002 (by ID, which is more stable than the text) or text matching user should not be .?root|runs? as root to container-privilege, matching the Semgrep rule. Add a case to TestParseRealScannerOutput asserting both scanners give the same class for the Dockerfile root user.
Acceptance criteria
- Trivy DS-0002 and Semgrep
last-user-is-rootproduce the same class. - The real-output test pins it.
Getting started
- Relevant files:
internal/seed/external.go,internal/seed/external_test.go - How to run tests:
go test ./internal/seed
Filed by repo-audit/fix-issues at b041273. Severity: low. Effort: S. audit-key: bug|internal/seed/external.go|trivyMisconfigClass
- Dominant language
- Go
- Stars
- 0
- Forks
- 1
- Avg merge
- 8h 14m
- Merged PRs (30d)
- 3
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TMHSDigital/Spackle
-
ci good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
TMHSDigital/Spackle#206 ·
Maintainers usually reply within 1 day
-
ci severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TMHSDigital/Spackle#205 ·
Maintainers usually reply within 1 day
-
bug good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
TMHSDigital/Spackle#199 ·
Maintainers usually reply within 1 day
-
bug good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
TMHSDigital/Spackle#195 ·
Maintainers usually reply within 1 day
-
documentation good first issue severity: medium
Difficulty 1/5 Under an hour Newbie friendliness 90/100
TMHSDigital/Spackle#188 ·
Maintainers usually reply within 1 day
All issues in TMHSDigital/Spackle
Similar issues
-
bug effort:s impact:med raised-by:worker risk:low to:worker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
medici-finance/assay#8120 · 1 comment ·
Maintainers usually reply within 1 day
-
factory:subtask
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
agent-substrate/substrate#4308 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
celestiaorg/celestia-app#8877 ·
Maintainers usually reply within 1 day
-
sweep
Difficulty 1/5 Under an hour Newbie friendliness 84/100
bketelsen/truenas-mcp#112 ·
Maintainers usually reply within 1 day