-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Swift: Add sinks for sqlite3 and SQLite.swift to swift/cleartext-storage-database #14312
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4245a38
Swift: Add SQLite.swift and sqlite3 C API test cases for swift/cleart…
geoffw0 16ae637
Swift: Add sqlite3 models.
geoffw0 839b963
Swift: Effect of fixing string interpolation bug.
geoffw0 4350060
Swift: Add SQLite.swift models.
geoffw0 6be01ea
Swift: Add implict read steps for dictionary content.
geoffw0 51ed824
Swift: Add more SQLite.swift models.
geoffw0 f9a617c
Swift: Change note.
geoffw0 0f1711f
Swift: Test insertMany.
geoffw0 6bea7f8
Merge branch 'main' into sqlpathinject2
geoffw0 7ddece1
Swift: Update .expected after merge.
geoffw0 fdcc6b4
Swift: Simplify allowImplicitRead slightly.
geoffw0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Provides models for SQL libraries. | ||
*/ | ||
|
||
import swift | ||
private import codeql.swift.dataflow.ExternalFlow | ||
|
||
/** | ||
* A model for SQL library functions that permit taint flow. | ||
*/ | ||
private class FilePathSummaries extends SummaryModelCsv { | ||
override predicate row(string row) { | ||
row = | ||
[ | ||
// SQLite.Swift | ||
";;false;<-(_:_:);;;Argument[0..1];ReturnValue;taint", | ||
";Expression;true;init(_:_:);;;Argument[0];ReturnValue;taint", | ||
";Expression;true;init(_:_:);;;Argument[1].CollectionElement;ReturnValue;taint", | ||
";ExpressionType;true;init(_:);;;Argument[0];ReturnValue;taint", | ||
";ExpressionType;true;replace(_:with:);;;Argument[1];ReturnValue;taint", | ||
] | ||
} | ||
} |
This file contains 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
This file contains 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
4 changes: 4 additions & 0 deletions
4
swift/ql/src/change-notes/2023-09-22-cleartext-storage-database-sinks.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: minorAnalysis | ||
--- | ||
* Added sqlite3 and SQLite.swift sinks and flow summaries for the `swift/cleartext-storage-database` query. |
Oops, something went wrong.
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.
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.
Should this be
Argument[0].CollectionElement
?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, but it can't be because at present MAD doesn't support access path syntax on sinks (or sources). I'm pushing for this feature because I think it's the natural way to express sinks like this.
The case should covered by the additional taint step at present, and that will be upgraded to an implicit read step in this query in #14357 .
I've just added tests for
insertMany
to this PR, as it's a special case that clearly deserves a test of its own.