-
Notifications
You must be signed in to change notification settings - Fork 861
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
Codeql detects zipslip vulnerability #8209
Conversation
where are you seeing the codeql failure? |
@laurit Would you mind linking to or screenshotting the codeql output? I couldn't find it in the nightly output.
Edit: Ok, after further looking, the |
if (!tempFile | ||
.getCanonicalFile() | ||
.toPath() | ||
.startsWith(tempDirectory.getCanonicalFile().toPath())) { |
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.
.startsWith(tempDirectory.getCanonicalFile().toPath())) { | |
.startsWith(tempDirectory.getCanonicalPath() + File.separator)) { |
It looks like appending the file separator to the end of the expected path is important in order to prevent writing to a neighboring directory. That is, if the actual temp dir is /tmp
and the file coming in from the zip somehow crafts ../../../../tmpOther
it could possibly write to /tmpOther
which should also be prevented.
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ExtensionClassLoader.java
Show resolved
Hide resolved
https://github.com/open-telemetry/opentelemetry-java-instrumentation/security/code-scanning |
I think that the only way zipslip could happen is when name contains
..
but codeql isn't able to cope with that. Removing the..
check gets rid of the code scanning alert.