-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Swift: Add some summary queries. #10903
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
adeef30
Swift: Add some queries to help examine databases.
geoffw0 5a35776
Swift: Improve metadata.
geoffw0 3215295
Swift: simpkify SummaryStats.ql description.
geoffw0 8a8b1af
Swift: Restrict expressions count to expressions with locations.
geoffw0 b59f01f
Swift: Use UnknownFile.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @name Flow Sources | ||
* @description List all flow sources found in the database. Flow sources | ||
* indicate data that originates from an untrusted source, such | ||
* as as untrusted remote data. | ||
* @kind problem | ||
* @problem.severity info | ||
* @id swift/summary/flow-sources | ||
* @tags summary | ||
*/ | ||
|
||
import swift | ||
import codeql.swift.dataflow.FlowSources | ||
|
||
from RemoteFlowSource s | ||
select s, "Flow source: " + s.getSourceType() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @name Sensitive Expressions | ||
* @description List all sensitive expressions found in the database. | ||
* Sensitive expressions are expressions that have been | ||
* identified as potentially containing data that should not be | ||
* leaked to an attacker. | ||
* @kind problem | ||
* @problem.severity info | ||
* @id swift/summary/sensitive-expressions | ||
* @tags summary | ||
*/ | ||
|
||
import swift | ||
import codeql.swift.security.SensitiveExprs | ||
|
||
from SensitiveExpr e | ||
select e, "Sensitive expression: " + e.getSensitiveType() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @name Summary statistics | ||
* @description A table of summary statistics about a database. | ||
* @kind table | ||
* @id swift/summary/summary-statistics | ||
* @tags summary | ||
*/ | ||
|
||
import swift | ||
import codeql.swift.dataflow.FlowSources | ||
import codeql.swift.security.SensitiveExprs | ||
|
||
predicate statistic(string what, int value) { | ||
what = "Files" and value = count(File f) | ||
or | ||
what = "Expressions" and value = count(Expr e | e.getFile().getName() != "") | ||
or | ||
what = "Remote flow sources" and value = count(RemoteFlowSource s) | ||
or | ||
what = "Sensitive expressions" and value = count(SensitiveExpr e) | ||
} | ||
|
||
from string what, int value | ||
where statistic(what, value) | ||
select what, value |
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.
Uh oh!
There was an error while loading. Please reload this page.