Repository navigation
Conversation
… (similar to original Swift).
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved detection gaps miss sensitive-named constructor calls and optional strings, while false positives affect Boolean members, default-redacted OSLog messages, and methods on unrelated receiver types.
5 open issues
What changed in this PR
Improves unified Swift cleartext-logging detection and refactors sensitive-source handling for reuse by other cleartext queries.
Changes:
- Moves access-chain propagation into query-level taint steps.
- Adds modeled logging sinks and name/type-based sink heuristics.
- Expands Swift regression cases and updates expected alerts and flow paths.
| File | Description |
|---|---|
unified/ql/test/query-tests/security/CWE-312/CleartextLogging/CleartextLoggingTest.swift |
Adds array, optional, nested-access, and logging-sink cases. |
unified/ql/test/query-tests/security/CWE-312/CleartextLogging/CleartextLogging.expected |
Updates expected alerts and data-flow paths. |
unified/ql/src/queries/security/CWE-312/CleartextLogging.ql |
Adds sink recognition and access-chain taint propagation. |
unified/ql/lib/codeql/unified/security/SensitiveData.qll |
Narrows source classification to sensitive identifier and member references. |
Review effort: Max (adaptive)
| ) | ||
| ) and | ||
| e = call.getAnArgument().getValue() and | ||
| TypeInference::inferType(e).asClass().getName() = ["String", "NSString"] and |
Contributor
Author
There was a problem hiding this comment.
I'll look into this.
| nodeTo.asExpr().(MemberAccessExpr).getBase() = nodeFrom.asExpr() | ||
| or | ||
| // if `a` is sensitive, then `a()` is also sensitive. | ||
| nodeTo.asExpr().(CallExpr).getCallee() = nodeFrom.asExpr() |
Contributor
Author
There was a problem hiding this comment.
Added the test and restored the old SensitiveDataCall class. Unless there's something cleverer we can do, it looks like we need both.
This branch has not been deployed
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.

Improvements to
unified/swift/cleartext-logging. Not high priority work, except that I want to use this query as a basis for othercleartext-*queries, and I’d rather fix as much as I can of it first.a.sensitive.b). We use additional flow steps now, as in the original Swift implementation, rather than hacks in the sensitive data library.DCA run to follow. There's a small chance the additional flow in
isAdditionalFlowStepcould cause performance problems, though something similar was OK in original Swift, and it does give better results.