-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: Fix Local Temp File/Dir Incorrect Guard Logic #8681
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
Conversation
53622c5
to
e65d4c0
Compare
java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql
Outdated
Show resolved
Hide resolved
@@ -58,7 +58,6 @@ private predicate isTaintPropagatingFileTransformation(Expr expSource, Expr expr | |||
* For example, `taintedFile.getCanonicalFile()` is itself tainted. | |||
*/ | |||
predicate isAdditionalFileTaintStep(DataFlow::Node node1, DataFlow::Node node2) { | |||
isFileConstructorArgument(node1.asExpr(), node2.asExpr(), _) or |
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.
Care to comment on this change?
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.
With this, I was having two paths get generated. When rendered, one of the paths wasn't showing the taint step where new File([tainted], [other])
was being called, but the other was. I'm not sure if it's because isAdditionalFileTaintStep
is written wrong, or not. But regardless, this line handles the case I was trying to cover anyways:
"java.io;File;false;File;;;Argument[0];Argument[-1];taint", |
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.
LGTM
Note that |
43cbc35
to
2753521
Compare
Resolves: #8032 (comment)
Thanks @aschackmull for your feedback and review!