mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Merge pull request #20961 from aschackmull/dataflow/flowfrom
Dataflow: Add flowFrom predicates to mirror flowTo.
This commit is contained in:
@@ -27,7 +27,7 @@ module AllocationSizeOverflow {
|
||||
private module FindLargeLensFlow = TaintTracking::Global<FindLargeLensConfig>;
|
||||
|
||||
private DataFlow::CallNode getALargeLenCall() {
|
||||
exists(DataFlow::Node lenArg | FindLargeLensFlow::flow(_, lenArg) |
|
||||
exists(DataFlow::Node lenArg | FindLargeLensFlow::flowTo(lenArg) |
|
||||
result.getArgument(0) = lenArg
|
||||
)
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ module UntrustedDataToUnknownExternalApiFlow =
|
||||
|
||||
/** A node representing untrusted data being passed to an external API. */
|
||||
class UntrustedExternalApiDataNode extends ExternalApiDataNode {
|
||||
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flow(_, this) }
|
||||
UntrustedExternalApiDataNode() { UntrustedDataToExternalApiFlow::flowTo(this) }
|
||||
|
||||
/** Gets a source of untrusted data which is passed to this external API data node. */
|
||||
DataFlow::Node getAnUntrustedSource() { UntrustedDataToExternalApiFlow::flow(result, this) }
|
||||
|
||||
@@ -15,7 +15,7 @@ module MissingJwtSignatureCheck {
|
||||
module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) {
|
||||
source instanceof Source and
|
||||
not SafeParse::flow(source, _)
|
||||
not SafeParse::flowFrom(source)
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
|
||||
|
||||
@@ -32,7 +32,7 @@ module UnsafeUnzipSymlink {
|
||||
* Holds if `node` is an archive header field read that flows to a `path/filepath.EvalSymlinks` call.
|
||||
*/
|
||||
private predicate symlinksEvald(DataFlow::Node node) {
|
||||
EvalSymlinksFlow::flow(getASimilarReadNode(node), _)
|
||||
EvalSymlinksFlow::flowFrom(getASimilarReadNode(node))
|
||||
}
|
||||
|
||||
private module Config implements DataFlow::ConfigSig {
|
||||
|
||||
@@ -81,5 +81,5 @@ module Config implements DataFlow::ConfigSig {
|
||||
module Flow = DataFlow::Global<Config>;
|
||||
|
||||
from DataFlow::Node source, string msg
|
||||
where Flow::flow(source, _) and Config::isSourceString(source, msg)
|
||||
where Flow::flowFrom(source) and Config::isSourceString(source, msg)
|
||||
select source, msg
|
||||
|
||||
@@ -154,7 +154,7 @@ module FlowToPrintFlow = DataFlow::Global<FlowToPrintConfig>;
|
||||
|
||||
/** Holds if the provided `CallNode`'s result flows to an argument of a printer call. */
|
||||
predicate resultFlowsToPrinter(DataFlow::CallNode authCodeUrlCall) {
|
||||
FlowToPrintFlow::flow(authCodeUrlCall.getResult(), _)
|
||||
FlowToPrintFlow::flowFrom(authCodeUrlCall.getResult())
|
||||
}
|
||||
|
||||
/** Get a data-flow node that reads the value of `os.Stdin`. */
|
||||
|
||||
@@ -21,6 +21,6 @@ where
|
||||
OpenUrlRedirect::Flow::flowPath(source, sink) and
|
||||
// this excludes flow from safe parts of request URLs, for example the full URL when the
|
||||
// doing a redirect from `http://<path>` to `https://<path>`
|
||||
not SafeUrlFlow::Flow::flow(_, sink.getNode())
|
||||
not SafeUrlFlow::Flow::flowTo(sink.getNode())
|
||||
select sink.getNode(), source, sink, "This path to an untrusted URL redirection depends on a $@.",
|
||||
source.getNode(), "user-provided value"
|
||||
|
||||
@@ -21,6 +21,6 @@ where
|
||||
RequestForgery::Flow::flowPath(source, sink) and
|
||||
request = sink.getNode().(RequestForgery::Sink).getARequest() and
|
||||
// this excludes flow from safe parts of request URLs, for example the full URL
|
||||
not SafeUrlFlow::Flow::flow(_, sink.getNode())
|
||||
not SafeUrlFlow::Flow::flowTo(sink.getNode())
|
||||
select request, source, sink, "The $@ of this request depends on a $@.", sink.getNode(),
|
||||
sink.getNode().(RequestForgery::Sink).getKind(), source, "user-provided value"
|
||||
|
||||
@@ -70,5 +70,6 @@ module PamStartToAuthenticateFlow = TaintTracking::Global<PamStartToAuthenticate
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where
|
||||
not isInTestFile(source.asExpr()) and
|
||||
(PamStartToAuthenticateFlow::flow(source, sink) and not PamStartToAcctMgmtFlow::flow(source, _))
|
||||
PamStartToAuthenticateFlow::flow(source, sink) and
|
||||
not PamStartToAcctMgmtFlow::flowFrom(source)
|
||||
select source, "This Pam transaction may not be secure."
|
||||
|
||||
@@ -24,7 +24,7 @@ module JwtParseWithConstantKeyConfig implements DataFlow::ConfigSig {
|
||||
or
|
||||
n = fd.(FuncDecl).getFunction().getARead()
|
||||
|
|
||||
GolangJwtKeyFunc::flow(n, _) and
|
||||
GolangJwtKeyFunc::flowFrom(n) and
|
||||
sink = rn and
|
||||
rn.getRoot() = fd and
|
||||
rn.getIndex() = 0
|
||||
|
||||
Reference in New Issue
Block a user