Swift: Fix defaultImplicitTaintRead on fields#14661
Merged
MathiasVP merged 4 commits intogithub:mainfrom Nov 8, 2023
Merged
Conversation
… on a subclass of the type containing the field.
Contributor
Author
|
DCA run LGTM. There's an analysis speedup on the run, which is plausible given the nature of this PR - but more likely to be just wobble. |
3 tasks
MathiasVP
approved these changes
Nov 8, 2023
Contributor
MathiasVP
left a comment
There was a problem hiding this comment.
Good catch! This LGTM!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix a bug in the
defaultImplicitTaintReadmechanism for reading from field access paths at sinks. Assumingsource()is a taint source andMid.fieldis a sink (say, defined through models-as-data), consider:Basedoes not have afield.source()to the access ofmidwith an access path for.field.defaultImplicitTaintReadrecognizes that the sink is an access toMidand permits any field ofMidto be stripped off the access path, and we get a result.source()to the access ofderivedwith an access path for.field. But this timedefaultImplicitTaintReadsees that the sink is an access toDerivedand permits any field ofDerivedto be stripped off the access path. That's not good enough, it needs to consider fields of base classes ofDerivedas well in order to findMid.field.In fact we had logic for this, but it was implemented the wrong way around.
TL;DR:
getABaseType*()was in the wrong place. Moving it fixes some sinks.I definitely want to do a DCA run on this one.