Trivy and Semgrep put the Dockerfile root user in different classes
維護者通常 1 天內回覆
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- Go
- 星號
- 0
- 分支
- 1
- 平均合併
- 8 小時 14 分鐘
- 30 天內合併 PR
- 3
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/Spackle 的其他 Issue
-
ci good first issue severity: low
難度 2/5 1-3 小時 新手友好度 77/100
TMHSDigital/Spackle#206 ·
維護者通常 1 天內回覆
-
ci severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Spackle#205 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 82/100
TMHSDigital/Spackle#199 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 87/100
TMHSDigital/Spackle#195 ·
維護者通常 1 天內回覆
-
documentation good first issue severity: medium
難度 1/5 1 小時以內 新手友好度 90/100
TMHSDigital/Spackle#188 ·
維護者通常 1 天內回覆
查看 TMHSDigital/Spackle 的全部 Issue
相似的 Issue
-
bug effort:s impact:med raised-by:worker risk:low to:worker
難度 2/5 1-3 小時 新手友好度 78/100
medici-finance/assay#8120 · 1 則留言 ·
維護者通常 1 天內回覆
-
factory:subtask
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
agent-substrate/substrate#4308 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
celestiaorg/celestia-app#8877 ·
維護者通常 1 天內回覆
-
sweep
難度 1/5 1 小時以內 新手友好度 84/100
bketelsen/truenas-mcp#112 ·
維護者通常 1 天內回覆