Skip to content

Commit 079294e

Browse files
committed
JS: Mass rename to node1,state1,node2,state2 naming convention
1 parent ac6da6c commit 079294e

34 files changed

+220
-218
lines changed

javascript/ql/examples/queries/dataflow/BackendIdor/BackendIdor.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ module IdorTaintConfig implements DataFlow::ConfigSig {
1818

1919
predicate isSink(DataFlow::Node node) { exists(ClientRequest req | node = req.getADataNode()) }
2020

21-
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
21+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2222
// Step from x -> { userId: x }
23-
succ.(DataFlow::SourceNode).getAPropertyWrite("userId").getRhs() = pred
23+
node2.(DataFlow::SourceNode).getAPropertyWrite("userId").getRhs() = node1
2424
}
2525

2626
predicate isBarrier(DataFlow::Node node) {

javascript/ql/examples/queries/dataflow/InformationDisclosure/InformationDisclosure.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ module AuthKeyTrackingConfig implements DataFlow::ConfigSig {
3737
)
3838
}
3939

40-
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
40+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
4141
// Step into objects: x -> { f: x }
42-
succ.(DataFlow::SourceNode).getAPropertyWrite().getRhs() = pred
42+
node2.(DataFlow::SourceNode).getAPropertyWrite().getRhs() = node1
4343
or
4444
// Step through JSON serialization: x -> JSON.stringify(x)
4545
// Note: TaintTracking::Configuration includes this step by default, but not DataFlow::Configuration
4646
exists(DataFlow::CallNode call |
4747
call = DataFlow::globalVarRef("JSON").getAMethodCall("stringify") and
48-
pred = call.getArgument(0) and
49-
succ = call
48+
node1 = call.getArgument(0) and
49+
node2 = call
5050
)
5151
}
5252
}

javascript/ql/lib/semmle/javascript/security/TaintedObject.qll

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,42 @@ module TaintedObject {
3636
/**
3737
* Holds for the flows steps that are relevant for tracking user-controlled JSON objects.
3838
*/
39-
predicate isAdditionalFlowStep(Node src, FlowState inlbl, Node trg, FlowState outlbl) {
39+
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
4040
// JSON parsers map tainted inputs to tainted JSON
41-
inlbl.isTaint() and
42-
outlbl.isTaintedObject() and
41+
state1.isTaint() and
42+
state2.isTaintedObject() and
4343
exists(JsonParserCall parse |
44-
src = parse.getInput() and
45-
trg = parse.getOutput()
44+
node1 = parse.getInput() and
45+
node2 = parse.getOutput()
4646
)
4747
or
4848
// Property reads preserve deep object taint.
49-
inlbl.isTaintedObject() and
50-
outlbl.isTaintedObject() and
51-
trg.(PropRead).getBase() = src
49+
state1.isTaintedObject() and
50+
state2.isTaintedObject() and
51+
node2.(PropRead).getBase() = node1
5252
or
5353
// Property projection preserves deep object taint
54-
inlbl.isTaintedObject() and
55-
outlbl.isTaintedObject() and
56-
trg.(PropertyProjection).getObject() = src
54+
state1.isTaintedObject() and
55+
state2.isTaintedObject() and
56+
node2.(PropertyProjection).getObject() = node1
5757
or
5858
// Extending objects preserves deep object taint
59-
inlbl.isTaintedObject() and
60-
outlbl.isTaintedObject() and
59+
state1.isTaintedObject() and
60+
state2.isTaintedObject() and
6161
exists(ExtendCall call |
62-
src = call.getAnOperand() and
63-
trg = call
62+
node1 = call.getAnOperand() and
63+
node2 = call
6464
or
65-
src = call.getASourceOperand() and
66-
trg = call.getDestinationOperand().getALocalSource()
65+
node1 = call.getASourceOperand() and
66+
node2 = call.getDestinationOperand().getALocalSource()
6767
)
6868
or
6969
// Spreading into an object preserves deep object taint: `p -> { ...p }`
70-
inlbl.isTaintedObject() and
71-
outlbl.isTaintedObject() and
70+
state1.isTaintedObject() and
71+
state2.isTaintedObject() and
7272
exists(ObjectLiteralNode obj |
73-
src = obj.getASpreadProperty() and
74-
trg = obj
73+
node1 = obj.getASpreadProperty() and
74+
node2 = obj
7575
)
7676
}
7777

@@ -96,8 +96,8 @@ module TaintedObject {
9696
/** Holds if this node blocks flow through `e`, provided it evaluates to `outcome`. */
9797
predicate blocksExpr(boolean outcome, Expr e) { none() }
9898

99-
/** Holds if this node blocks flow of `label` through `e`, provided it evaluates to `outcome`. */
100-
predicate blocksExpr(boolean outcome, Expr e, FlowState label) { none() }
99+
/** Holds if this node blocks flow of `state` through `e`, provided it evaluates to `outcome`. */
100+
predicate blocksExpr(boolean outcome, Expr e, FlowState state) { none() }
101101

102102
/** DEPRECATED. Use `blocksExpr` instead. */
103103
deprecated predicate sanitizes(boolean outcome, Expr e, FlowLabel label) {

javascript/ql/lib/semmle/javascript/security/TaintedUrlSuffixCustomizations.qll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ module TaintedUrlSuffix {
6666
}
6767

6868
/**
69-
* Holds if there is a flow step `src -> dst` involving the URL suffix flow state.
69+
* Holds if there is a flow step `node1 -> node2` involving the URL suffix flow state.
7070
*
7171
* This handles steps through string operations, promises, URL parsers, and URL accessors.
7272
*/
73-
predicate isAdditionalFlowStep(Node src, FlowState srclbl, Node dst, FlowState dstlbl) {
73+
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
7474
// Transition from tainted-url-suffix to general taint when entering the second array element
7575
// of a split('#') or split('?') array.
7676
//
@@ -79,17 +79,17 @@ module TaintedUrlSuffix {
7979
// Technically we should also preverse tainted-url-suffix when entering the first array element of such
8080
// a split, but this mostly leads to FPs since we currently don't track if the taint has been through URI-decoding.
8181
// (The query/fragment parts are often URI-decoded in practice, but not the other URL parts are not)
82-
srclbl.isTaintedUrlSuffix() and
83-
dstlbl.isTaint() and
84-
DataFlowPrivate::optionalStep(src, "split-url-suffix-post", dst)
82+
state1.isTaintedUrlSuffix() and
83+
state2.isTaint() and
84+
DataFlowPrivate::optionalStep(node1, "split-url-suffix-post", node2)
8585
or
8686
// Transition from URL suffix to full taint when extracting the query/fragment part.
87-
srclbl.isTaintedUrlSuffix() and
88-
dstlbl.isTaint() and
87+
state1.isTaintedUrlSuffix() and
88+
state2.isTaint() and
8989
(
9090
exists(MethodCallNode call, string name |
91-
src = call.getReceiver() and
92-
dst = call and
91+
node1 = call.getReceiver() and
92+
node2 = call and
9393
name = call.getMethodName()
9494
|
9595
// Substring that is not a prefix
@@ -118,22 +118,22 @@ module TaintedUrlSuffix {
118118
)
119119
or
120120
exists(PropRead read |
121-
src = read.getBase() and
122-
dst = read and
121+
node1 = read.getBase() and
122+
node2 = read and
123123
// Unlike the `search` property, the `query` property from `url.parse` does not include the `?`.
124124
read.getPropertyName() = "query"
125125
)
126126
or
127127
exists(MethodCallNode call, DataFlow::RegExpCreationNode re |
128128
(
129129
call = re.getAMethodCall("exec") and
130-
src = call.getArgument(0) and
131-
dst = call
130+
node1 = call.getArgument(0) and
131+
node2 = call
132132
or
133133
call.getMethodName() = ["match", "matchAll"] and
134134
re.flowsTo(call.getArgument(0)) and
135-
src = call.getReceiver() and
136-
dst = call
135+
node1 = call.getReceiver() and
136+
node2 = call
137137
)
138138
|
139139
captureAfterSuffixIndicator(re.getRoot().getAChild*())

javascript/ql/lib/semmle/javascript/security/dataflow/BuildArtifactLeakQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ module BuildArtifactLeakConfig implements DataFlow::ConfigSig {
2121

2222
predicate isBarrier(DataFlow::Node node) { node instanceof CleartextLogging::Barrier }
2323

24-
predicate isAdditionalFlowStep(DataFlow::Node src, DataFlow::Node trg) {
25-
CleartextLogging::isAdditionalTaintStep(src, trg)
24+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
25+
CleartextLogging::isAdditionalTaintStep(node1, node2)
2626
}
2727

2828
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet contents) {

javascript/ql/lib/semmle/javascript/security/dataflow/CleartextLoggingQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ module CleartextLoggingConfig implements DataFlow::ConfigSig {
3232
isSource(node)
3333
}
3434

35-
predicate isAdditionalFlowStep(DataFlow::Node src, DataFlow::Node trg) {
36-
CleartextLogging::isAdditionalTaintStep(src, trg)
35+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
36+
CleartextLogging::isAdditionalTaintStep(node1, node2)
3737
}
3838

3939
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet contents) {

javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideRequestForgeryQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ module ClientSideRequestForgeryConfig implements DataFlow::ConfigSig {
2828

2929
predicate isBarrierOut(DataFlow::Node node) { sanitizingPrefixEdge(node, _) }
3030

31-
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
32-
isAdditionalRequestForgeryStep(pred, succ)
31+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
32+
isAdditionalRequestForgeryStep(node1, node2)
3333
}
3434
}
3535

javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideUrlRedirectQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module ClientSideUrlRedirectConfig implements DataFlow::StateConfigSig {
4141

4242
predicate isBarrierOut(DataFlow::Node node) { hostnameSanitizingPrefixEdge(node, _) }
4343

44-
predicate isBarrierOut(DataFlow::Node node, FlowState label) { isSink(node, label) }
44+
predicate isBarrierOut(DataFlow::Node node, FlowState state) { isSink(node, state) }
4545

4646
predicate isAdditionalFlowStep(
4747
DataFlow::Node node1, FlowState state1, DataFlow::Node node2, FlowState state2

javascript/ql/lib/semmle/javascript/security/dataflow/ConditionalBypassQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ module ConditionalBypassConfig implements DataFlow::ConfigSig {
2020

2121
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
2222

23-
predicate isAdditionalFlowStep(DataFlow::Node src, DataFlow::Node dst) {
23+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2424
// comparing a tainted expression against a constant gives a tainted result
25-
dst.asExpr().(Comparison).hasOperands(src.asExpr(), any(ConstantExpr c))
25+
node2.asExpr().(Comparison).hasOperands(node1.asExpr(), any(ConstantExpr c))
2626
}
2727
}
2828

javascript/ql/lib/semmle/javascript/security/dataflow/ExceptionXssQuery.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ module ExceptionXssConfig implements DataFlow::StateConfigSig {
146146
}
147147

148148
predicate isAdditionalFlowStep(
149-
DataFlow::Node pred, FlowState inlbl, DataFlow::Node succ, FlowState outlbl
149+
DataFlow::Node node1, FlowState state1, DataFlow::Node node2, FlowState state2
150150
) {
151-
inlbl = FlowState::notYetThrown() and
152-
outlbl = [FlowState::thrown(), FlowState::notYetThrown()] and
153-
canThrowSensitiveInformation(pred) and
154-
succ = getExceptionTarget(pred)
151+
state1 = FlowState::notYetThrown() and
152+
state2 = [FlowState::thrown(), FlowState::notYetThrown()] and
153+
canThrowSensitiveInformation(node1) and
154+
node2 = getExceptionTarget(node1)
155155
}
156156
}
157157

0 commit comments

Comments
 (0)