-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add a github check for programs not using traversal #8698
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #8698 will not alter performanceComparing Summary
Footnotes
|
GNU testsuite comparison:
|
221e3b9
to
0881dcf
Compare
GNU testsuite comparison:
|
0881dcf
to
f739e60
Compare
GNU testsuite comparison:
|
f739e60
to
f4bfb67
Compare
GNU testsuite comparison:
|
33ad553
to
5082e23
Compare
GNU testsuite comparison:
|
5082e23
to
2ce39de
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
3ebac82
to
1376176
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
42d619c
to
7bbd68d
Compare
GNU testsuite comparison:
|
7bbd68d
to
210cf9a
Compare
GNU testsuite comparison:
|
210cf9a
to
0ff9bb8
Compare
GNU testsuite comparison:
|
0ff9bb8
to
e9aa7c5
Compare
GNU testsuite comparison:
|
bd0ab13
to
d00a2c9
Compare
d00a2c9
to
da38534
Compare
GNU testsuite comparison:
|
# Build utilities if not already built | ||
if [ ! -f "$PROJECT_ROOT/target/release/rm" ]; then | ||
echo "Building utilities..." | ||
cd "$PROJECT_ROOT" | ||
cargo build --release --quiet | ||
fi | ||
|
||
# Check if we should use individual binaries or multicall binary | ||
# Prefer individual binaries for more accurate testing | ||
if [ -f "$PROJECT_ROOT/target/release/rm" ]; then | ||
echo "Using individual binaries (preferred for testing)" | ||
USE_MULTICALL=0 | ||
elif [ -f "$PROJECT_ROOT/target/release/coreutils" ]; then | ||
echo "Using multicall binary: $PROJECT_ROOT/target/release/coreutils" | ||
USE_MULTICALL=1 | ||
COREUTILS_BIN="$PROJECT_ROOT/target/release/coreutils" | ||
else | ||
echo "No binaries found - please build first" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this script intended to be used outside of the CI? If not, you could omit these checks.
|
||
# Check for dangerous patterns across all logs | ||
echo "Checking for dangerous path resolution patterns..." | ||
echo "✓ Basic safe traversal verification completed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This output feels out of place. I guess it should be shown before the "Additional Safety Checks"?
(stderr.contains("rm: cannot remove 'a/1': Directory not empty") | ||
&& stderr.contains("rm: cannot remove 'a': Directory not empty")) | ||
|| (stderr.contains("rm: cannot remove 'a/1/2': Permission denied") | ||
&& stderr.contains("rm: cannot remove 'b/3': Permission denied")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for the OR? I would expect that the command always returns the same error messages.
stderr.contains("rm: cannot remove directory 'b/a/p': Permission denied") | ||
|| stderr.contains("rm: cannot remove 'b/a/p': Permission denied") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I don't understand why there is an OR.
match wrap_chown( | ||
// Use safe syscalls for root directory to prevent TOCTOU attacks | ||
#[cfg(target_os = "linux")] | ||
let chown_result = if path.is_dir() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could use cfg!
in the condition. It would allow you to get rid of the duplicate block starting on line 335.
dir_fd: &DirFd, | ||
path: &Path, | ||
meta: &Metadata, | ||
) -> Result<String, String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for the String
in the "ok" case? The function always returns an empty string in that case, so my suggestion is to use Result<(), String>
as return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will continue with the review of linux.rs
and rm.rs
tomorrow, the other files are reviewed.
No description provided.