-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Swift: Modernize the swift/string-length-conflation query #12642
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
… what really happens.
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 once DCA is happy.
class StringLengthConflationConfiguration extends TaintTracking::Configuration { | ||
StringLengthConflationConfiguration() { this = "StringLengthConflationConfiguration" } | ||
|
||
override predicate isSource(DataFlow::Node node, string flowstate) { |
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.
Once Swift starts converting dataflow configurations to modules this flowstate
could be simplified to a newtype with 5 unit branches.
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.
Yes, I noticed we will benefit from the new configurations here. I've added a note of your exact suggestion to https://github.com/github/codeql-c-team/issues/1625.
We lose an alert on DCA. I need to look into this. Performance is fine. |
Fixed the regression. For some reason none of the string views work well expressed in MaD, so they are now all defined in QL. Not ideal, but its difficult to investigate further as these are built-in classes. I also did a MRVA top 1000 run for the base + new top of this branch to check for any other regressions. We lose 5 FPs and gain 2 TPs, I found no other changes. |
DCA LGTM. |
Modernize the
swift/string-length-conflation
query:Note that the existing weaknesses in the definitions of sources and sinks in this query become more explicit here (references to too general classes
Collection
,Sequence
etc appear that were implicit before), but on the positive side they're actually slightly more constrained now than before. I've created an issue to find a way to make this better: https://github.com/github/codeql-c-team/issues/1655I've tested this on the MRVA top 100 - revealing a few false positive results that have been fixed by the slightly more precise sinks. I've also added some test cases inspired by that.
I will do a DCA run as well...