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: archive extraction header.Linkname and old dependencies #80

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

@mohanmanikanta2299 mohanmanikanta2299 requested a review from a team as a code owner January 31, 2025 14:43
@dduzgun-security dduzgun-security changed the title CVE Fixes fix: archive extraction header.Linkname and old dependencies Jan 31, 2025
Copy link
Collaborator

@dduzgun-security dduzgun-security left a 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) {
Copy link
Collaborator

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

Copy link
Author

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.

Copy link
Author

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, "/") {
Copy link
Collaborator

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.

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.

2 participants