-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Remove path traversal CWE-23 #8331
Conversation
Signed-off-by: Alex Collins <alex_collins@intuit.com>
@@ -832,7 +836,7 @@ func untar(tarPath string, destPath string) error { | |||
case header == nil: | |||
continue | |||
} | |||
target := filepath.Join(dest, header.Name) | |||
target := filepath.Join(dest, filepath.Clean(header.Name)) |
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 should be clean instead of filepath.clean
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 accidentally pushed the clean
func, I've reverted.
I wanted understand how Clean
worked with values such as ../../foo
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.
Got it.
@@ -832,7 +836,7 @@ func untar(tarPath string, destPath string) error { | |||
case header == nil: | |||
continue | |||
} | |||
target := filepath.Join(dest, header.Name) | |||
target := filepath.Join(dest, filepath.Clean(header.Name)) |
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.
Got it.
Signed-off-by: Alex Collins alex_collins@intuit.com
https://app.snyk.io/org/argoproj/project/e917d104-c0c4-477b-853c-9d1451b6f803
You can test these fixes locally: