Skip to content

Swift: Add AdditionalTaintStep#11273

Merged
atorralba merged 1 commit intogithub:mainfrom
atorralba:atorralba/swift/string-utf8-step
Nov 15, 2022
Merged

Swift: Add AdditionalTaintStep#11273
atorralba merged 1 commit intogithub:mainfrom
atorralba:atorralba/swift/string-utf8-step

Conversation

@atorralba
Copy link
Copy Markdown
Contributor

@atorralba atorralba commented Nov 15, 2022

Adds the abstract class AdditionalTaintStep to allow creating flow steps that apply to all taint tracking configurations.

@atorralba atorralba requested a review from a team as a code owner November 15, 2022 13:41
@github-actions github-actions Bot added the Swift label Nov 15, 2022
Comment thread swift/ql/lib/codeql/swift/frameworks/StandardLibrary/String.qll Fixed
Copy link
Copy Markdown
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM, but we should make sure to sync this up with what @karimhamdanali has been working on.

Comment on lines +10 to +16
class AdditionalTaintStep extends Unit {
/**
* Holds if the step from `node1` to `node2` should be considered a taint
* step for all configurations.
*/
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM 👍.

}

/** A global taint step for the read of the `utf8` field of a tainted `String`. */
private class StringUtf8Step extends AdditionalTaintStep {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this overlaps with #11185, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, true. It's even more general than my approach, so we should prioritize that. I'm surprised that #11185 doesn't affect the data.swift test cases though 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I now see that the base of that PR didn't yet include the init CSV model of Data, that's why other test cases aren't affected. I'm going to remove the string step then, and make this PR only add the abstract AdditionalTaintStep.

@atorralba atorralba force-pushed the atorralba/swift/string-utf8-step branch from b1c894e to 8ca004f Compare November 15, 2022 15:14
@atorralba atorralba changed the title Swift: Add taint step for the String.utf8 view Swift: Add AdditionalTaintStep Nov 15, 2022
@atorralba atorralba merged commit 89a8ccb into github:main Nov 15, 2022
@atorralba atorralba deleted the atorralba/swift/string-utf8-step branch November 15, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants