Skip to content

fix: avoid sudo argument false positives - #318

Open
Eljees wants to merge 1 commit into
goodwithtech:masterfrom
Eljees:agent/fix-sudo-removal-false-positive
Open

fix: avoid sudo argument false positives#318
Eljees wants to merge 1 commit into
goodwithtech:masterfrom
Eljees:agent/fix-sudo-removal-false-positive

Conversation

@Eljees

@Eljees Eljees commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • report sudo only when it appears in a shell command position
  • ignore occurrences used as ordinary arguments, such as find -iname sudo
  • keep detecting direct calls, shell-wrapped calls, and calls after command separators

Root cause

useSudo treated any token equal to sudo as an executed command. This produced DKL-DI-0001 findings when an image build merely referenced the filename, including commands that delete the binary.

Testing

  • go test ./pkg/assessor/manifest -count=1
  • go vet ./pkg/assessor/manifest

Fixes #278

Signed-off-by: Eljees <3.14hell@gmail.com>
@Eljees
Eljees force-pushed the agent/fix-sudo-removal-false-positive branch from 447d491 to 715d6f0 Compare July 29, 2026 18:56
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.

False positive on DKL-DI-0001 (Avoid sudo command)

1 participant