Skip to content

Commit 607ad1f

Browse files
authored
Merge pull request #20961 from aschackmull/dataflow/flowfrom
Dataflow: Add flowFrom predicates to mirror flowTo.
2 parents e74031b + 78e1879 commit 607ad1f

File tree

42 files changed

+77
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+77
-53
lines changed

cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ExternalAPIsSpecific
1010

1111
/** A node representing untrusted data being passed to an external API. */
1212
class UntrustedExternalApiDataNode extends ExternalApiDataNode {
13-
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flow(_, this) }
13+
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flowTo(this) }
1414

1515
/** Gets a source of untrusted data which is passed to this external API data node. */
1616
DataFlow::Node getAnUntrustedSource() { UntrustedDataToExternalApiFlow::flow(result, this) }

cpp/ql/src/Security/CWE/CWE-020/ir/ExternalAPIs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ExternalAPIsSpecific
1010

1111
/** A node representing untrusted data being passed to an external API. */
1212
class UntrustedExternalApiDataNode extends ExternalApiDataNode {
13-
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flow(_, this) }
13+
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flowTo(this) }
1414

1515
/** Gets a source of untrusted data which is passed to this external API data node. */
1616
DataFlow::Node getAnUntrustedSource() { UntrustedDataToExternalApiFlow::flow(result, this) }

cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ module FromSensitiveFlow = TaintTracking::Global<FromSensitiveConfig>;
263263
* A taint flow configuration for flow from a sensitive expression to an encryption operation.
264264
*/
265265
module ToEncryptionConfig implements DataFlow::ConfigSig {
266-
predicate isSource(DataFlow::Node source) { FromSensitiveFlow::flow(source, _) }
266+
predicate isSource(DataFlow::Node source) { FromSensitiveFlow::flowFrom(source) }
267267

268268
predicate isSink(DataFlow::Node sink) { isSinkEncrypt(sink, _) }
269269

@@ -311,7 +311,7 @@ where
311311
FromSensitiveFlow::flowPath(source, sink) and
312312
isSinkSendRecv(sink.getNode(), networkSendRecv) and
313313
// no flow from sensitive -> evidence of encryption
314-
not ToEncryptionFlow::flow(source.getNode(), _) and
314+
not ToEncryptionFlow::flowFrom(source.getNode()) and
315315
not FromEncryptionFlow::flowTo(sink.getNode()) and
316316
// construct result
317317
if networkSendRecv instanceof NetworkSend

cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ module PointerArithmeticToDerefFlow = DataFlow::Global<PointerArithmeticToDerefC
129129

130130
predicate pointerArithOverflow(PointerArithmeticInstruction pai, int delta) {
131131
pointerArithOverflow0(pai, delta) and
132-
PointerArithmeticToDerefFlow::flow(DataFlow::instructionNode(pai), _)
132+
PointerArithmeticToDerefFlow::flowFrom(DataFlow::instructionNode(pai))
133133
}
134134

135135
bindingset[v]

csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class IDbCommandConstructionSqlExpr extends SqlExpr, ObjectCreation {
5252
class DapperCommandDefinitionMethodCallSqlExpr extends SqlExpr, ObjectCreation {
5353
DapperCommandDefinitionMethodCallSqlExpr() {
5454
this.getObjectType() instanceof Dapper::CommandDefinitionStruct and
55-
DapperCommandDefinitionMethodCallSql::flow(DataFlow::exprNode(this), _)
55+
DapperCommandDefinitionMethodCallSql::flowFromExpr(this)
5656
}
5757

5858
override Expr getSql() { result = this.getArgumentForName("commandText") }

csharp/ql/lib/semmle/code/csharp/security/dataflow/ExternalAPIsQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module RemoteSourceToExternalApi = TaintTracking::Global<RemoteSourceToExternalA
8585

8686
/** A node representing untrusted data being passed to an external API. */
8787
class UntrustedExternalApiDataNode extends ExternalApiDataNode {
88-
UntrustedExternalApiDataNode() { RemoteSourceToExternalApi::flow(_, this) }
88+
UntrustedExternalApiDataNode() { RemoteSourceToExternalApi::flowTo(this) }
8989

9090
/** Gets a source of untrusted data which is passed to this external API data node. */
9191
DataFlow::Node getAnUntrustedSource() { RemoteSourceToExternalApi::flow(result, this) }

csharp/ql/lib/semmle/code/csharp/security/dataflow/ReDoSQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class ExponentialRegexSink extends DataFlow::ExprNode, Sink {
9191
ExponentialRegexSink() {
9292
exists(RegexOperation regexOperation |
9393
// Exponential regex flows to the pattern argument
94-
ExponentialRegexDataFlow::flow(_, DataFlow::exprNode(regexOperation.getPattern()))
94+
ExponentialRegexDataFlow::flowToExpr(regexOperation.getPattern())
9595
|
9696
// This is used as an input for this pattern
9797
this.getExpr() = regexOperation.getInput() and

csharp/ql/src/Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ where
5353
// JsonConvert static method call, but with additional unsafe typename tracking
5454
exists(DataFlow::Node settingsCallArg |
5555
JsonConvertTracking::flowPath(userInput.asPathNode3(), deserializeCallArg.asPathNode3()) and
56-
TypeNameTracking::flow(_, settingsCallArg) and
56+
TypeNameTracking::flowTo(settingsCallArg) and
5757
sameParent(deserializeCallArg.getNode(), settingsCallArg)
5858
)
5959
select deserializeCallArg, userInput, deserializeCallArg, "$@ flows to unsafe deserializer.",

csharp/ql/src/Security Features/CWE-614/CookieWithoutSecure.ql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ predicate insecureCookieOptionsCreation(ObjectCreation oc) {
4646
// `Secure` property in `CookieOptions` passed to IResponseCookies.Append(...) wasn't set
4747
oc.getType() instanceof MicrosoftAspNetCoreHttpCookieOptions and
4848
secureFalseOrNotSet(oc) and
49-
exists(DataFlow::Node creation |
50-
CookieOptionsTracking::flow(creation, _) and
51-
creation.asExpr() = oc
52-
)
49+
CookieOptionsTracking::flowFromExpr(oc)
5350
}
5451

5552
predicate insecureCookieAppend(Expr sink) {

go/ql/lib/semmle/go/security/AllocationSizeOverflow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module AllocationSizeOverflow {
2727
private module FindLargeLensFlow = TaintTracking::Global<FindLargeLensConfig>;
2828

2929
private DataFlow::CallNode getALargeLenCall() {
30-
exists(DataFlow::Node lenArg | FindLargeLensFlow::flow(_, lenArg) |
30+
exists(DataFlow::Node lenArg | FindLargeLensFlow::flowTo(lenArg) |
3131
result.getArgument(0) = lenArg
3232
)
3333
}

0 commit comments

Comments
 (0)