C++: Upgrade cpp/cleartext-storage-buffer#7742
Conversation
| import semmle.code.cpp.security.SensitiveExprs | ||
| import TaintedWithPath | ||
| import semmle.code.cpp.security.Security | ||
| import semmle.code.cpp.dataflow.TaintTracking |
There was a problem hiding this comment.
This change is moving from IR taint tracking to AST taint tracking, which is a bit sad. Could we replace this with semmle.code.cpp.ir.dataflow.TaintTracking?
There was a problem hiding this comment.
Ah that's interesting, I thought the the security lib / default taint tracking used AST taint.
I'll update it to be IR-based...
There was a problem hiding this comment.
Fantastic! Here's a quick summary:
semmle.code.cpp.security.TaintTrackingis an alias forsemmle.code.cpp.ir.dataflow.DefaultTaintTracking(which is an IR taint tracking library that uses an IRDataFlowconfiguration)semmle.code.cpp.dataflow.TaintTrackingis an AST taint tracking librarysemmle.code.cpp.ir.dataflow.TaintTrackingis an IR taint tracking library built on an IRTaintTrackingconfiguration. By now I think this library should mostly be superior tosemmle.code.cpp.dataflow.TaintTracking, but there are a few limitations that mostly shouldn't matter in practice.
There was a problem hiding this comment.
I've just done two things:
- put it back on IR taint tracking, but no longer via relying on DefaultTaintTracking. This is probably slightly untidier than what we started with, but opens the possibility to replace security library
isUserInputwith modern flow sources (which I should look at later today...) - I've also added to QLDoc at the top of two of the library files you described above. That should help us (and others) remember which is which in future.
There was a problem hiding this comment.
I've updated it to use FlowSource, which is cleaner and appears to give better textual explanations of the source.
MathiasVP
left a comment
There was a problem hiding this comment.
LGTM! Are the results still the expected set of results?
| ToBufferConfiguration() { this = "ToBufferConfiguration" } | ||
|
|
||
| override predicate isSource(DataFlow::Node source) { isUserInput(source.asExpr(), _) } | ||
| override predicate isSource(DataFlow::Node source) { isUserInput(exprForNode(source), _) } |
There was a problem hiding this comment.
Do we get the same results if we use Oh, you did exactly that in the last commit. Excellent!source instanceof FlowSource? Then we don't need this ugly exprForNode (as FlowSource.getSourceType can be used instead of isUserInput to get the taintCause).
|
Yep, results on the test and a very ugly LGTM diff are the same. I was hoping to get some new ones, but there you go. |


Resolves a bit more of the inconsistency between
cpp/cleartext-transmission,cpp/cleartext-storage-fileandcpp/cleartext-storage-bufferby upgrading the third one from security to AST taint flow.We still use the old security library's
isUserInputto identify inputs, that could be upgraded as well but may have a bigger impact on results.LGTM diff query: https://lgtm.com/query/6710910426361157574/ (sparse results, no differences)