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

Resolve CodeQL zip slip warning #13183

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

trask
Copy link
Member

@trask trask commented Feb 4, 2025

@@ -303,8 +303,16 @@ private URL findJarResource(String name) {
private URL getJarEntryUrl(JarEntry jarEntry) {
if (jarEntry != null) {
try {
return new URL(jarBase, jarEntry.getName());
} catch (MalformedURLException e) {
String entryName = jarEntry.getName();
Copy link
Contributor

Choose a reason for hiding this comment

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

The intent of the warning is that when you extract jar entries into a directory and there is a malicious entry that contains .. you may up overwriting something outside of the directory where you were extracting the jar. Imo the codeql warning here isn't justified as the jar entry name isn't really used for an io operation. I think it should be possible to circumvent this. Since we look up the JarEntry by name we don't need to use getName() but can remember the name that we used to look it up.

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative implementation #13193

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