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

internal/releasesjson: Prevent path traversal #92

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

radeksimko
Copy link
Member

As reported by CodeQL scanner, the code in question is potentially vulnerable to path traversal, i.e. reading files outside of expected path. However, in the context of hc-install we generally trust the source ZIP files as hosted on releases.hashicorp.com, since HashiCorp produces all of them anyway.

That said, there's nothing wrong with defence in depth.

References

@radeksimko radeksimko added the bug Something isn't working label Jan 18, 2023
@radeksimko radeksimko requested a review from kmoe January 18, 2023 08:19
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀 The standard for HashiCorp release zip archives is never any path traversals. (If we really wanted to be pedantic, we could split unpack into its own function and unit test for this, but I'm not sure that's worth the effort to be honest.)

@radeksimko radeksimko merged commit baca000 into main Jan 18, 2023
@radeksimko radeksimko deleted the fix-avoid-path-traversal branch January 18, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants