mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Update PotentiallyExposedSystemData with DataFlow::ConfigSig
This commit is contained in:
@@ -28,17 +28,15 @@ import cpp
|
|||||||
import semmle.code.cpp.ir.dataflow.TaintTracking
|
import semmle.code.cpp.ir.dataflow.TaintTracking
|
||||||
import semmle.code.cpp.models.interfaces.FlowSource
|
import semmle.code.cpp.models.interfaces.FlowSource
|
||||||
import semmle.code.cpp.security.OutputWrite
|
import semmle.code.cpp.security.OutputWrite
|
||||||
import DataFlow::PathGraph
|
import PotentiallyExposedSystemData::PathGraph
|
||||||
import SystemData
|
import SystemData
|
||||||
|
|
||||||
class PotentiallyExposedSystemDataConfiguration extends TaintTracking::Configuration {
|
module PotentiallyExposedSystemDataConfiguration implements DataFlow::ConfigSig {
|
||||||
PotentiallyExposedSystemDataConfiguration() { this = "PotentiallyExposedSystemDataConfiguration" }
|
predicate isSource(DataFlow::Node source) {
|
||||||
|
|
||||||
override predicate isSource(DataFlow::Node source) {
|
|
||||||
source = any(SystemData sd | sd.isSensitive()).getAnExpr()
|
source = any(SystemData sd | sd.isSensitive()).getAnExpr()
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate isSink(DataFlow::Node sink) {
|
predicate isSink(DataFlow::Node sink) {
|
||||||
exists(OutputWrite ow, Expr child | child = ow.getASource().getAChild*() |
|
exists(OutputWrite ow, Expr child | child = ow.getASource().getAChild*() |
|
||||||
// Most sinks receive a pointer as an argument (for example `printf`),
|
// Most sinks receive a pointer as an argument (for example `printf`),
|
||||||
// and we use an indirect sink for those.
|
// and we use an indirect sink for those.
|
||||||
@@ -53,9 +51,10 @@ class PotentiallyExposedSystemDataConfiguration extends TaintTracking::Configura
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
from
|
module PotentiallyExposedSystemData =
|
||||||
PotentiallyExposedSystemDataConfiguration config, DataFlow::PathNode source,
|
TaintTracking::Make<PotentiallyExposedSystemDataConfiguration>;
|
||||||
DataFlow::PathNode sink
|
|
||||||
where config.hasFlowPath(source, sink)
|
from PotentiallyExposedSystemData::PathNode source, PotentiallyExposedSystemData::PathNode sink
|
||||||
|
where PotentiallyExposedSystemData::hasFlowPath(source, sink)
|
||||||
select sink, source, sink, "This operation potentially exposes sensitive system data from $@.",
|
select sink, source, sink, "This operation potentially exposes sensitive system data from $@.",
|
||||||
source, source.getNode().toString()
|
source, source.getNode().toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user