Skip to content

Commit 89a8ccb

Browse files
authored
Merge pull request github#11273 from atorralba/atorralba/swift/string-utf8-step
Swift: Add `AdditionalTaintStep`
2 parents 0570610 + 8ca004f commit 89a8ccb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

swift/ql/lib/codeql/swift/dataflow/FlowSteps.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import swift
22
private import codeql.swift.dataflow.DataFlow
33

4+
/**
5+
* A unit class for adding additional taint steps.
6+
*
7+
* Extend this class to add additional taint steps that should apply to all
8+
* taint configurations.
9+
*/
10+
class AdditionalTaintStep extends Unit {
11+
/**
12+
* Holds if the step from `node1` to `node2` should be considered a taint
13+
* step for all configurations.
14+
*/
15+
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
16+
}
17+
418
/**
519
* A `Content` that should be implicitly regarded as tainted whenever an object with such `Content`
620
* is itself tainted.

swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ private module Cached {
6464
or
6565
// flow through a flow summary (extension of `SummaryModelCsv`)
6666
FlowSummaryImpl::Private::Steps::summaryLocalStep(nodeFrom, nodeTo, false)
67+
or
68+
any(AdditionalTaintStep a).step(nodeFrom, nodeTo)
6769
}
6870

6971
/**

0 commit comments

Comments
 (0)