-
Notifications
You must be signed in to change notification settings - Fork 18
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: archive extraction header.Linkname and old dependencies #80
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks a lot for looking into that, really appreciate the work. Left some comments and it would be nice to add lots of unit tests (expected failure and valid ones) covering different scenarios included.
slug.go
Outdated
@@ -552,6 +568,17 @@ func (p *Packer) validSymlink(root, path, target string) (bool, error) { | |||
} | |||
} | |||
|
|||
func TargetWithinRoot(root string, target string) (bool, error) { |
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.
Should we move this to /internal/escapingfs/escapes.go
? I'm sure this would be useful for future validations outside of the slug.go
file too
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.
Do we need to create a new file in the said location ?
/internal/escapingfs/escapes.go -- cannot find any existing file or filepath mentioned.
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.
Made the changes. Created a new file and a test file.
@@ -539,8 +548,15 @@ func (p *Packer) validSymlink(root, path, target string) (bool, error) { | |||
if !strings.HasSuffix(prefix, "/") { |
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.
String manipulation here after a clean may cause some issues that we faced before that was resolved by d8b1ee7. The filepath.Join
function should already handle missing "/"
. Some tests would be helpful on here for this.
This PR is to fix the CVEs in below tickets: