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
Swift: Imprecise Taint Flows #14925
base: main
Are you sure you want to change the base?
Swift: Imprecise Taint Flows #14925
Conversation
|
DCA run looks clean. |
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.
One comment, but otherwise this LGTM
| ce.getStaticTarget().(Function).getShortName() = ["append", "insert"] and | ||
| arg.getLabel() = ["", "contentsOf"] and | ||
| node1.asExpr() = arg.getExpr() and | ||
| node2.asExpr() = ce.getQualifier() |
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.
Should this really be the qualifier expression? I would have expected this to be
node.(PostUpdateNode).getPreUpdateNode().asExpr() = ce.getQualifier()to reflect the fact that this is the value of the expression after append returns


Adds a small number of imprecise taint flow models. There's a lot more we could potentially do here, but lets start small for now:
Collection(which we can model and I think do model most of), but quite often these patterns are also copied in classes that do not derived fromCollection. By using an imprecise model, we can catch the latter as well.There's a contents / flow paths issue here - we only have flow path support on MAD flow models, not on QL flow models which these imprecise sinks have to be - so we can't have flow from the contents of the argument to the contents of the qualifier. That's why we don't catch the cases on lines 118 and 119 of the test where taint was introduced in the contents of the
taintedArrayargument rather than intaintedArrayitself. I'm keen to hear thoughts on how we could solve this.