Java: Add additional File taint value flow models#8884
Conversation
File taint value flow modelsFile taint value flow models
Adds - File::getAbsoluteFile - File::getCanonicalFile - File::getAbsolutePath - File::getCanonicalPath
40ecf39 to
2565cdb
Compare
Click to show differences in coveragejavaGenerated file changes for java
- Java Standard Library,``java.*``,3,541,115,28,,,7,,,10
+ Java Standard Library,``java.*``,3,545,115,28,,,7,,,10
- Totals,,183,6233,1441,106,6,10,107,33,1,81
+ Totals,,183,6237,1441,106,6,10,107,33,1,81
- java.io,37,,31,,15,,,,,,,,,,,,,,,,,,22,,,,,,,31,
+ java.io,37,,35,,15,,,,,,,,,,,,,,,,,,22,,,,,,,35, |
|
These changes are good as-is. It looks like none of the existing tests break. Any issues with these @aschackmull? |
|
The performance of this seems OK. It adds a bunch of results to several projects and queries but I cursorily reviewed them and they make sense. @JLLeitschuh for some reason your query |
|
I've looked at the paths generated from
I'm not really concerned about the loss of a single path here. |
Marcono1234
left a comment
There was a problem hiding this comment.
There are some other File methods which might also be interesting for taint propagation, but including them is probably out of scope I guess (especially since this pull request is already approved).
| "java.net;URI;false;toAsciiString;;;Argument[-1];ReturnValue;taint", | ||
| "java.io;File;false;toURI;;;Argument[-1];ReturnValue;taint", | ||
| "java.io;File;false;toPath;;;Argument[-1];ReturnValue;taint", | ||
| "java.io;File;true;getAbsoluteFile;;;Argument[-1];ReturnValue;taint", |
There was a problem hiding this comment.
For consistency with the two lines above should this be changed to not consider subtypes (false), though java.io.File can be subclassed (even though it is unlikely that many subclasses exist), so maybe the lines above should be changed (false → true)?
There was a problem hiding this comment.
The File class can, and does (rarely) get extended. Solid example of it happening here:
There was a problem hiding this comment.
Updated to change them all to true
Click to show differences in coveragejavaGenerated file changes for java
- Java Standard Library,``java.*``,3,545,115,28,,,7,,,10
+ Java Standard Library,``java.*``,3,549,115,28,,,7,,,10
- Totals,,213,6305,1441,106,6,10,107,33,1,81
+ Totals,,213,6309,1441,106,6,10,107,33,1,81
- java.io,37,,35,,15,,,,,,,,,,,,,,,,,,22,,,,,,,35,
+ java.io,37,,39,,15,,,,,,,,,,,,,,,,,,22,,,,,,,39, |
Adds taint models for:
File::getAbsoluteFileFile::getCanonicalFileFile::getAbsolutePathFile::getCanonicalPath