зеркало из https://github.com/github/codeql.git
Python: Move `XmlBomb` to new dataflow API
This commit is contained in:
Родитель
add1077532
Коммит
46322b717a
|
@ -12,9 +12,11 @@ import semmle.python.dataflow.new.TaintTracking
|
||||||
import XmlBombCustomizations::XmlBomb
|
import XmlBombCustomizations::XmlBomb
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* DEPRECATED: Use `XmlBombFlow` module instead.
|
||||||
|
*
|
||||||
* A taint-tracking configuration for detecting "XML bomb" vulnerabilities.
|
* A taint-tracking configuration for detecting "XML bomb" vulnerabilities.
|
||||||
*/
|
*/
|
||||||
class Configuration extends TaintTracking::Configuration {
|
deprecated class Configuration extends TaintTracking::Configuration {
|
||||||
Configuration() { this = "XmlBomb" }
|
Configuration() { this = "XmlBomb" }
|
||||||
|
|
||||||
override predicate isSource(DataFlow::Node source) { source instanceof Source }
|
override predicate isSource(DataFlow::Node source) { source instanceof Source }
|
||||||
|
@ -26,3 +28,14 @@ class Configuration extends TaintTracking::Configuration {
|
||||||
node instanceof Sanitizer
|
node instanceof Sanitizer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private module XmlBombConfig implements DataFlow::ConfigSig {
|
||||||
|
predicate isSource(DataFlow::Node source) { source instanceof Source }
|
||||||
|
|
||||||
|
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
|
||||||
|
|
||||||
|
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Global taint-tracking for detecting "XML bomb" vulnerabilities. */
|
||||||
|
module XmlBombFlow = TaintTracking::Global<XmlBombConfig>;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
import python
|
import python
|
||||||
import semmle.python.security.dataflow.XmlBombQuery
|
import semmle.python.security.dataflow.XmlBombQuery
|
||||||
import DataFlow::PathGraph
|
import XmlBombFlow::PathGraph
|
||||||
|
|
||||||
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
|
from XmlBombFlow::PathNode source, XmlBombFlow::PathNode sink
|
||||||
where cfg.hasFlowPath(source, sink)
|
where XmlBombFlow::flowPath(source, sink)
|
||||||
select sink.getNode(), source, sink,
|
select sink.getNode(), source, sink,
|
||||||
"XML parsing depends on a $@ without guarding against uncontrolled entity expansion.",
|
"XML parsing depends on a $@ without guarding against uncontrolled entity expansion.",
|
||||||
source.getNode(), "user-provided value"
|
source.getNode(), "user-provided value"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче