Skip to content

Commit 355ccf4

Browse files
author
Alvaro Muñoz
committed
Do not compress local flow steps
Use `neverSkipPathGrap` to `any()` so no local flow steps get pruned and thrown away in order to compress the presented dataflow path.
1 parent 45d959d commit 355ccf4

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

ql/lib/codeql/actions/dataflow/internal/DataFlowImplSpecific.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
private import codeql.dataflow.DataFlow
77

88
module ActionsDataFlow implements InputSig {
9-
import DataFlowPrivate
9+
import DataFlowPrivate as Private
1010
import DataFlowPublic
11+
import Private
12+
13+
predicate neverSkipInPathGraph = Private::neverSkipInPathGraph/1;
1114
}

ql/lib/codeql/actions/dataflow/internal/DataFlowPrivate.qll

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -207,27 +207,6 @@ predicate stepOutputDefToUse(Node nodeFrom, Node nodeTo) {
207207
)
208208
}
209209

210-
predicate test1(UsesExpr u, string f, JobStmt j) {
211-
u.getLocation().getFile().getBaseName() = "inter1.yml" and
212-
f = u.getId() and
213-
j = u.getJob()
214-
}
215-
216-
predicate test2(StepOutputAccessExpr r, string f, JobStmt j) {
217-
r.getLocation().getFile().getBaseName() = "inter1.yml" and
218-
f = r.getStepId() and
219-
j = r.getJob()
220-
}
221-
222-
predicate test3(UsesExpr u, StepOutputAccessExpr r, Node n) {
223-
r.getLocation().getFile().getBaseName() = "inter1.yml" and
224-
u.getLocation().getFile().getBaseName() = "inter1.yml" and
225-
u.getId() = r.getStepId() and
226-
u.getJob() = r.getJob() and
227-
// el SOAE has no mapping DF NODE
228-
n.asExpr() = r
229-
}
230-
231210
predicate jobOutputDefToUse(Node nodeFrom, Node nodeTo) {
232211
// nodeTo is a JobOutputAccessExpr and nodeFrom is the Job output expression
233212
exists(Expression astFrom, JobOutputAccessExpr astTo |
@@ -310,3 +289,10 @@ predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) { no
310289

311290
/** Extra data-flow steps needed for lambda flow analysis. */
312291
predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preservesValue) { none() }
292+
293+
/**
294+
* Since our model is so simple, we dont want to compress the local flow steps.
295+
* This compression is normally done to not show SSA steps, casts, etc.
296+
*/
297+
predicate neverSkipInPathGraph(Node node) { any() }
298+

ql/src/Security/CWE-094/ExpressionInjection.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ private module MyConfig implements DataFlow::ConfigSig {
2424
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
2525

2626
predicate isSink(DataFlow::Node sink) { sink instanceof ExpressionInjectionSink }
27+
//predicate neverSkip(DataFlow::Node node) { any() }
2728
}
2829

2930
module MyFlow = TaintTracking::Global<MyConfig>;

0 commit comments

Comments
 (0)