Skip to content

Commit 87afdae

Browse files
committed
use hasFlowTo where possible
1 parent 52b650a commit 87afdae

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ql/src/experimental/CWE-942/CorsMisconfiguration.ql

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ predicate allowCredentialsIsSetToTrue(AllowOriginHeaderWrite allowOriginHW) {
9191
* The `message` parameter is populated with the warning message to be returned by the query.
9292
*/
9393
predicate flowsFromUntrustedToAllowOrigin(AllowOriginHeaderWrite allowOriginHW, string message) {
94-
exists(FlowsUntrustedToAllowOriginHeader cfg, DataFlow::PathNode source, DataFlow::PathNode sink |
95-
cfg.hasFlowPath(source, sink) and
96-
cfg.isSink(sink.getNode(), allowOriginHW)
94+
exists(FlowsUntrustedToAllowOriginHeader cfg, DataFlow::Node sink |
95+
cfg.hasFlowTo(sink) and
96+
cfg.isSink(sink, allowOriginHW)
9797
|
9898
message =
9999
headerAllowOrigin() + " header is set to a user-defined value, and " +
@@ -168,11 +168,8 @@ class FlowsFromUntrusted extends TaintTracking::Configuration {
168168
* Holds if the provided `dst` is also destination of a `UntrustedFlowSource`.
169169
*/
170170
predicate flowsToGuardedByCheckOnUntrusted(AllowOriginHeaderWrite allowOriginHW) {
171-
exists(
172-
FlowsFromUntrusted cfg, DataFlow::PathNode source, DataFlow::PathNode sink,
173-
ControlFlow::ConditionGuardNode cgn
174-
|
175-
cfg.hasFlowPath(source, sink) and cfg.isSink(sink.getNode(), cgn)
171+
exists(FlowsFromUntrusted cfg, DataFlow::Node sink, ControlFlow::ConditionGuardNode cgn |
172+
cfg.hasFlowTo(sink) and cfg.isSink(sink, cgn)
176173
|
177174
cgn.dominates(allowOriginHW.getBasicBlock())
178175
)

0 commit comments

Comments
 (0)