mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C#: Re-factor SettingsDataFlow to use the new API.
This commit is contained in:
@@ -162,18 +162,14 @@ class XmlReaderSettingsCreation extends ObjectCreation {
|
||||
}
|
||||
}
|
||||
|
||||
private class SettingsDataFlowConfig extends DataFlow3::Configuration {
|
||||
SettingsDataFlowConfig() { this = "SettingsDataFlowConfig" }
|
||||
private module SettingsDataFlowConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof XmlReaderSettingsCreation }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) {
|
||||
source.asExpr() instanceof XmlReaderSettingsCreation
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
sink.asExpr() instanceof XmlReaderSettingsInstance
|
||||
}
|
||||
predicate isSink(DataFlow::Node sink) { sink.asExpr() instanceof XmlReaderSettingsInstance }
|
||||
}
|
||||
|
||||
private module SettingsDataFlow = DataFlow::Global<SettingsDataFlowConfig>;
|
||||
|
||||
/** A call to `XmlReader.Create`. */
|
||||
class XmlReaderCreateCall extends MethodCall {
|
||||
XmlReaderCreateCall() { this.getTarget() = any(SystemXmlXmlReaderClass r).getCreateMethod() }
|
||||
@@ -190,8 +186,6 @@ class XmlReaderSettingsInstance extends Expr {
|
||||
|
||||
/** Gets a possible creation point for this instance of `XmlReaderSettings`. */
|
||||
XmlReaderSettingsCreation getASettingsCreation() {
|
||||
exists(SettingsDataFlowConfig settingsFlow |
|
||||
settingsFlow.hasFlow(DataFlow::exprNode(result), DataFlow::exprNode(this))
|
||||
)
|
||||
SettingsDataFlow::flow(DataFlow::exprNode(result), DataFlow::exprNode(this))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user