зеркало из https://github.com/github/codeql.git
Use `MapMutation` instead of `MethodCall`
This commit is contained in:
Родитель
e14be0e971
Коммит
a528db8958
|
@ -5,13 +5,6 @@ private import semmle.code.java.dataflow.FlowSources
|
||||||
private import semmle.code.java.Maps
|
private import semmle.code.java.Maps
|
||||||
private import semmle.code.java.JDK
|
private import semmle.code.java.JDK
|
||||||
|
|
||||||
private class MapUpdateWithKeyOrValue extends MethodCall {
|
|
||||||
MapUpdateWithKeyOrValue() {
|
|
||||||
this.getMethod() instanceof MapMethod and
|
|
||||||
this.getMethod().getName().matches(["put%", "remove", "replace"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private module ProcessBuilderEnvironmentConfig implements DataFlow::ConfigSig {
|
private module ProcessBuilderEnvironmentConfig implements DataFlow::ConfigSig {
|
||||||
predicate isSource(DataFlow::Node source) {
|
predicate isSource(DataFlow::Node source) {
|
||||||
exists(MethodCall mc | mc = source.asExpr() |
|
exists(MethodCall mc | mc = source.asExpr() |
|
||||||
|
@ -19,9 +12,7 @@ private module ProcessBuilderEnvironmentConfig implements DataFlow::ConfigSig {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate isSink(DataFlow::Node sink) {
|
predicate isSink(DataFlow::Node sink) { sink.asExpr() = any(MapMutation mm).getQualifier() }
|
||||||
sink.asExpr() = any(MapUpdateWithKeyOrValue mm).getQualifier()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private module ProcessBuilderEnvironmentFlow = DataFlow::Global<ProcessBuilderEnvironmentConfig>;
|
private module ProcessBuilderEnvironmentFlow = DataFlow::Global<ProcessBuilderEnvironmentConfig>;
|
||||||
|
@ -43,7 +34,7 @@ module ExecTaintedEnvironmentConfig implements DataFlow::ConfigSig {
|
||||||
sinkNode(sink, "environment-injection")
|
sinkNode(sink, "environment-injection")
|
||||||
or
|
or
|
||||||
// sink is a key or value added to a `ProcessBuilder::environment` map.
|
// sink is a key or value added to a `ProcessBuilder::environment` map.
|
||||||
exists(MapUpdateWithKeyOrValue mm | mm.getAnArgument() = sink.asExpr() |
|
exists(MapMutation mm | mm.getAnArgument() = sink.asExpr() |
|
||||||
ProcessBuilderEnvironmentFlow::flowToExpr(mm.getQualifier())
|
ProcessBuilderEnvironmentFlow::flowToExpr(mm.getQualifier())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче