Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unbounded ellipsis match in tar-insecure-flags rule #49

Merged
merged 5 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions generic/tar-insecure-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ tar -xvf --Psomeotherflag archive.tar

# ok: tar-insecure-flags
tar -xvf archive.tar

# Unbounded ellipsis span in pattern wraps to next command in some scenarios
# ok: tar-insecure-flags
wget https://git.kernel.org/torvalds/t/linux-6.8-rc1.tar.gz -O - | tar -xz -C / && mv linux-6.8-rc1 linux
muschempax marked this conversation as resolved.
Show resolved Hide resolved

# This shouldn't match, but the ellipsis wrap picks up the p flag in this command and associates it with the previous command
wget https://github.com/trailofbits/semgrep-rules -P /ToB/
2 changes: 2 additions & 0 deletions generic/tar-insecure-flags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ rules:
impact: HIGH
references:
- https://man7.org/linux/man-pages/man1/tar.1.html
options:
generic_ellipsis_max_span: 0
pattern-either:
# A space character was left at the end of some patterns to help ensure
# that the intended flag was used, and minimize the chance that another,
Expand Down
Loading