Ruby: Rewrite a few ::Range uses to instanceof

This commit is contained in:
Rasmus Wriedt Larsen
2022-09-13 15:36:42 +02:00
parent 46751e515c
commit 511030df48
2 changed files with 7 additions and 19 deletions

View File

@@ -611,16 +611,12 @@ module CodeExecution {
* Extend this class to refine existing API models. If you want to model new APIs,
* extend `XmlParserCall::Range` instead.
*/
class XmlParserCall extends DataFlow::Node {
XmlParserCall::Range range;
XmlParserCall() { this = range }
class XmlParserCall extends DataFlow::Node instanceof XmlParserCall::Range {
/** Gets the argument that specifies the XML content to be parsed. */
DataFlow::Node getInput() { result = range.getInput() }
DataFlow::Node getInput() { result = super.getInput() }
/** Holds if this XML parser call is configured to process external entities */
predicate externalEntitiesEnabled() { range.externalEntitiesEnabled() }
predicate externalEntitiesEnabled() { super.externalEntitiesEnabled() }
}
/** Provides a class for modeling new XML parsing APIs. */
@@ -790,13 +786,9 @@ module CookieSecurityConfigurationSetting {
* Extend this class to refine existing API models. If you want to model new APIs,
* extend `Logging::Range` instead.
*/
class Logging extends DataFlow::Node {
Logging::Range range;
Logging() { this = range }
class Logging extends DataFlow::Node instanceof Logging::Range {
/** Gets an input that is logged. */
DataFlow::Node getAnInput() { result = range.getAnInput() }
DataFlow::Node getAnInput() { result = super.getAnInput() }
}
/** Provides a class for modeling new logging mechanisms. */

View File

@@ -13,13 +13,9 @@ private import codeql.ruby.Frameworks
* Extend this class to refine existing API models. If you want to model new APIs,
* extend `RemoteFlowSource::Range` instead.
*/
class RemoteFlowSource extends DataFlow::Node {
RemoteFlowSource::Range self;
RemoteFlowSource() { this = self }
class RemoteFlowSource extends DataFlow::Node instanceof RemoteFlowSource::Range {
/** Gets a string that describes the type of this remote flow source. */
string getSourceType() { result = self.getSourceType() }
string getSourceType() { result = super.getSourceType() }
}
/** Provides a class for modeling new sources of remote user input. */