Repository navigation
Unified: Add a unified Swift sensitive data library and use it in unified/swift/cleartext-logging - #23131
Open
geoffw0 wants to merge 10 commits into
Open
Unified: Add a unified Swift sensitive data library and use it in unified/swift/cleartext-logging#23131geoffw0 wants to merge 10 commits into
geoffw0 wants to merge 10 commits into
Conversation
…d, to reduce noise).
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The receiver-chain logic incorrectly marks enclosing comparisons as sensitive while missing chains rooted in sensitive identifiers, causing both false positives and missed sensitive-data logging.
2 open issues
What changed in this PR
Adds reusable sensitive-data detection for unified Swift analysis and integrates it into the cleartext-logging query.
Changes:
- Detect sensitive identifiers, member-access chains, and call results using shared heuristics.
- Move alert locations to sources and update the alert message.
- Port and expand Swift tests, documenting known missing and spurious results.
| File | Description |
|---|---|
unified/ql/test/query-tests/security/CWE-312/CleartextLogging/CleartextLoggingTest.swift |
Adds Swift logging and sensitive-data test cases. |
unified/ql/test/query-tests/security/CWE-312/CleartextLogging/CleartextLogging.expected |
Records expanded results and source-based alert locations. |
unified/ql/src/queries/security/CWE-312/CleartextLogging.ql |
Uses the new library and updates alert locations and wording. |
unified/ql/lib/codeql/unified/security/SensitiveData.qll |
Introduces reusable sensitive-data source classification. |
Review effort: Max (dynamic)
| override SensitiveDataClassification getClassification() { result = classification } | ||
| } | ||
|
|
||
| private Expr memberAccessParent(MemberAccessExpr e) { result = e.getParent() } |
Comment on lines
+54
to
+56
| exists(MemberAccessExpr e | memberAccessParent*(e) = this.asExpr() | | ||
| HeuristicNames::nameIndicatesSensitiveData(e.getMemberName(), classification) | ||
| ) |
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.

Add a unified Swift sensitive data library and use it in
unified/swift/cleartext-logging.Shared data library:
Cleartext logging:
Not done yet: