-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Swift: Adopt the shared sensitive data library #13190
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
…(argument:list:).
…need to be private data as well.
I've just pushed changes so that we no longer use the |
Ready for review. The vast majority of false positive concerns have been addressed by removing the |
I should add, I've finished the MRVA testing. We're not completely free of false positives sources (we never were, it's heuristic), e.g.
but after a few iterations I'm confident that actual results (i.e. sources that connect to sinks) are very good. Most of the testing actually included some additional heuristic regexps as well, which I don't want to pollute this PR with. i.e. there will be a second PR. It was more efficient to test both sets of changes together. |
DCA shows three result changes:
|
DCA still shows three result changes, but now they're all new results:
I think these are all good, or at least plausibly good results. |
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 except for a small comment.
swift/schema.py
Outdated
name: optional[string] | doc("name of this callable") | desc("The name includes any arguments " | ||
"of the callable, for example `myFunction(arg:)`.") |
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.
To stick with the right Swift terminology we should probably be more precise what we mean by "argument" here. Swift has both argument labels, and parameter names (see here), and I think the name we produce for a function declaration uses the argument label.
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, it's the argument labels here. Parameter names are internal implementation details of the function and nobody else should care about them.
I've reworded slightly (and fixed the merge conflict).
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!
Adopt the shared sensitive data library
SensitiveDataHeuristics.qll
, that is shared across languageteams. Unfortunately it turns out this only replaces about half of the logic in
SensitiveExprs.qll
(the rest being handled by another set of heuristicsPrivateData.qll
in some languages). Thus, things aren't as clean as I'd hoped at this stage, but this PR is a start...swift/cleartext-*
queries 🎉I'm not sure about the--- addressed by removing theuserId
andusername
patterns; some of these results will be valuable TPs, some FP because the username is public anyway. A clear example:URL(string: "https://socialwebsite.com/\(username)")
id()
category of heuristics.I'm not confident about--- addressed by removing theuuid
either (.uuid
,.uuidString
,taskUUID
and stuff like that); these mostly come from https://developer.apple.com/documentation/foundation/uuid , and I don't see any reason to mark them as sensitive.id()
category of heuristics.SecTrustGetCertificateCount
is clearly not a certificate. --- exclude by "count" but not "account"?"image", as in--- addressed by removing the.gitAccountImage
is clearly not an account number.id()
category of heuristics; I'm also considering the word "image" as a "probably safe" indicator."useridle" is not a "userid".--- addressed by removing theid()
category of heuristics--- this seems to be a one-off, most matches of "account" LGTM.accountVC
(VC = ViewController); the old version avoided this by only matchingaccountid
/account.?key
/bank.?account
so I'm wondering if all uses ofaccount
is too wide.NSLocalizedString(constant)
, regardless of the name of that constant. e.g. something likelet passwordPrompt = NSLocalizedString(passwordPrompt)
. AndNSLocalizedString(:tableName:comment:)
. I've seen this a couple of times so it's probably worth doing at some point. --- planned as follow-up.this is a draft PR for now, pending discussion and/or my exploring this a bit deeper.TODO: when this is ready, it will need a change note as well.--- done.