Swift: Add CollectionContent to defaultImplicitTaintRead #14521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's been observed that quite a lot of Swift queries have an
allowImplicitRead
rule for reading out ofCollectionContent
; and it's been further pointed out that we could put that rule indefaultImplicitTaintRead
so that it applies to all queries. This behaviour is not expected to ever be undesirable in the context of taint flow queries, so having it there simplifies queries and helps avoid mistakes*. This PR does this change.*
- it turns out we do indeed find some new good results in some of the encryption queries as a result of this change - though new barriers were also required to prevent result duplication.Performance is a slight concern, though we've seen no problems in the queries that were already doing this via
allowImplicitRead
. I want to call out that we're matchingCollectionContent
without restricting the node, whereas the Java equivalent case makes some effort to narrow the DataFlow nodes it applies to. I believe matching all nodes is what we want - quite a broad range of nodes could containCollectionContent
and I would not want to miss some of them out. There is a restriction to (roughly) sink nodes that comes intodefaultImplicitTaintRead
through thebindingset[node]
annotation, so we're not really matching all nodes anyway. There's also only oneCollectionContent
type in Swift, so a cartesian product is impossible. In any case I've briefly tested performance locally (with no clear result), and DCA should confirm no slowdown.Note to self: there's another case of
allowImplicitRead
in #14383 . I can remove it after this PR is merged.