Skip to content

Commit d74e84a

Browse files
committed
JS: Remove or update some mentions of AdditionalTaintStep
1 parent c0b5a9a commit d74e84a

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

docs/codeql/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,23 +439,24 @@ additional taint step from the first argument of ``resolveSymlinks`` to its resu
439439
}
440440
441441
We might even consider adding this as a default taint step to be used by all taint-tracking configurations. In order to do this, we need
442-
to wrap it in a new subclass of ``TaintTracking::AdditionalTaintStep`` like this:
442+
to wrap it in a new subclass of ``TaintTracking::SharedTaintStep`` like this:
443443
444444
.. code-block:: ql
445445
446-
class StepThroughResolveSymlinks extends TaintTracking::AdditionalTaintStep, DataFlow::CallNode {
447-
StepThroughResolveSymlinks() { this = DataFlow::moduleImport("resolve-symlinks").getACall() }
448-
446+
class StepThroughResolveSymlinks extends TaintTracking::SharedTaintStep {
449447
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
450-
pred = this.getArgument(0) and
451-
succ = this
448+
exists(DataFlow::CallNode c |
449+
c = DataFlow::moduleImport("resolve-symlinks").getACall() and
450+
pred = c.getArgument(0) and
451+
succ = c
452+
)
452453
}
453454
}
454455
455456
If we add this definition to the standard library, it will be picked up by all taint-tracking configurations. Obviously, one has to be
456457
careful when adding such new additional taint steps to ensure that they really make sense for `all` configurations.
457458
458-
Analogous to ``TaintTracking::AdditionalTaintStep``, there is also a class ``DataFlow::AdditionalFlowStep`` that can be extended to add
459+
Analogous to ``TaintTracking::SharedTaintStep``, there is also a class ``DataFlow::AdditionalFlowStep`` that can be extended to add
459460
extra steps to all data-flow configurations, and hence also to all taint-tracking configurations.
460461
461462
Exercises

javascript/ql/src/semmle/javascript/security/dataflow/PrototypePollutingAssignment.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ module PrototypePollutingAssignment {
100100
// users wouldn't bother to call Object.create in that case.
101101
result = DataFlow::globalVarRef("Object").getAMemberCall("create")
102102
or
103-
// Allow use of AdditionalFlowSteps and AdditionalTaintSteps to track a bit further
103+
// Allow use of AdditionalFlowSteps to track a bit further
104104
exists(DataFlow::Node mid |
105105
prototypeLessObject(t.continue()).flowsTo(mid) and
106106
any(DataFlow::AdditionalFlowStep s).step(mid, result)

javascript/ql/test/tutorials/Analyzing data flow in JavaScript/Global data flow/query5.ql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import javascript
22

3-
class StepThroughResolveSymlinks extends TaintTracking::AdditionalTaintStep, DataFlow::CallNode {
4-
StepThroughResolveSymlinks() { this = DataFlow::moduleImport("resolve-symlinks").getACall() }
5-
3+
class StepThroughResolveSymlinks extends TaintTracking::SharedTaintStep {
64
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
7-
pred = this.getArgument(0) and
8-
succ = this
5+
exists(DataFlow::CallNode c |
6+
c = DataFlow::moduleImport("resolve-symlinks").getACall() and
7+
pred = c.getArgument(0) and
8+
succ = c
9+
)
910
}
1011
}
1112

0 commit comments

Comments
 (0)