Skip to content

Commit e669754

Browse files
committed
Swift: Also add local flow sources to summary queries.
1 parent be05b80 commit e669754

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

swift/ql/src/queries/Summary/FlowSources.ql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@
1212
import swift
1313
import codeql.swift.dataflow.FlowSources
1414

15-
from RemoteFlowSource s
16-
select s, "Flow source: " + s.getSourceType()
15+
string sourceType(FlowSource s) {
16+
s instanceof LocalFlowSource and result = "LocalFlowSource"
17+
or
18+
s instanceof RemoteFlowSource and result = "RemoteFlowSource"
19+
}
20+
21+
from FlowSource s
22+
select s, sourceType(s) + ": " + s.getSourceType()

swift/ql/src/queries/Summary/SummaryStats.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ predicate statistic(string what, int value) {
1515
or
1616
what = "Expressions" and value = count(Expr e | not e.getFile() instanceof UnknownFile)
1717
or
18+
what = "Local flow sources" and value = count(LocalFlowSource s)
19+
or
1820
what = "Remote flow sources" and value = count(RemoteFlowSource s)
1921
or
2022
what = "Sensitive expressions" and value = count(SensitiveExpr e)

0 commit comments

Comments
 (0)