mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Merge pull request #19518 from jketema/depr
C++/Swift: delete outdated deprecations
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
category: breaking
|
||||
---
|
||||
* Deleted the deprecated `userInputArgument` predicate and its convenience accessor from the `Security.qll`.
|
||||
* Deleted the deprecated `userInputReturned` predicate and its convenience accessor from the `Security.qll`.
|
||||
* Deleted the deprecated `userInputReturn` predicate from the `Security.qll`.
|
||||
* Deleted the deprecated `isUserInput` predicate and its convenience accessor from the `Security.qll`.
|
||||
* Deleted the deprecated `userInputArgument` predicate from the `SecurityOptions.qll`.
|
||||
* Deleted the deprecated `userInputReturned` predicate from the `SecurityOptions.qll`.
|
||||
@@ -98,19 +98,6 @@ class Node extends TNode {
|
||||
/** Gets the location of this element. */
|
||||
Location getLocation() { none() } // overridden by subclasses
|
||||
|
||||
/**
|
||||
* Holds if this element is at the specified location.
|
||||
* The location spans column `startcolumn` of line `startline` to
|
||||
* column `endcolumn` of line `endline` in file `filepath`.
|
||||
* For more information, see
|
||||
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||
*/
|
||||
deprecated predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an upper bound on the type of this node.
|
||||
*/
|
||||
|
||||
@@ -538,19 +538,6 @@ class Node extends TIRDataFlowNode {
|
||||
none() // overridden by subclasses
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this element is at the specified location.
|
||||
* The location spans column `startcolumn` of line `startline` to
|
||||
* column `endcolumn` of line `endline` in file `filepath`.
|
||||
* For more information, see
|
||||
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||
*/
|
||||
deprecated predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
cached
|
||||
final string toString() {
|
||||
|
||||
@@ -42,58 +42,6 @@ class SecurityOptions extends string {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The argument of the given function is filled in from user input.
|
||||
*/
|
||||
deprecated predicate userInputArgument(FunctionCall functionCall, int arg) {
|
||||
exists(string fname |
|
||||
functionCall.getTarget().hasGlobalOrStdName(fname) and
|
||||
exists(functionCall.getArgument(arg)) and
|
||||
(
|
||||
fname = ["fread", "fgets", "fgetws", "gets"] and arg = 0
|
||||
or
|
||||
fname = "scanf" and arg >= 1
|
||||
or
|
||||
fname = "fscanf" and arg >= 2
|
||||
)
|
||||
or
|
||||
functionCall.getTarget().hasGlobalName(fname) and
|
||||
exists(functionCall.getArgument(arg)) and
|
||||
fname = "getaddrinfo" and
|
||||
arg = 3
|
||||
)
|
||||
or
|
||||
exists(RemoteFlowSourceFunction remote, FunctionOutput output |
|
||||
functionCall.getTarget() = remote and
|
||||
output.isParameterDerefOrQualifierObject(arg) and
|
||||
remote.hasRemoteFlowSource(output, _)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The return value of the given function is filled in from user input.
|
||||
*/
|
||||
deprecated predicate userInputReturned(FunctionCall functionCall) {
|
||||
exists(string fname |
|
||||
functionCall.getTarget().getName() = fname and
|
||||
(
|
||||
fname = ["fgets", "gets"] or
|
||||
this.userInputReturn(fname)
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(RemoteFlowSourceFunction remote, FunctionOutput output |
|
||||
functionCall.getTarget() = remote and
|
||||
(output.isReturnValue() or output.isReturnValueDeref()) and
|
||||
remote.hasRemoteFlowSource(output, _)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: Users should override `userInputReturned()` instead.
|
||||
*/
|
||||
deprecated predicate userInputReturn(string function) { none() }
|
||||
|
||||
/**
|
||||
* The argument of the given function is used for running a process or loading
|
||||
* a library.
|
||||
@@ -108,29 +56,6 @@ class SecurityOptions extends string {
|
||||
function = ["LoadLibrary", "LoadLibraryA", "LoadLibraryW"] and arg = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* This predicate should hold if the expression is directly
|
||||
* computed from user input. Such expressions are treated as
|
||||
* sources of taint.
|
||||
*/
|
||||
deprecated predicate isUserInput(Expr expr, string cause) {
|
||||
exists(FunctionCall fc, int i |
|
||||
this.userInputArgument(fc, i) and
|
||||
expr = fc.getArgument(i) and
|
||||
cause = fc.getTarget().getName()
|
||||
)
|
||||
or
|
||||
exists(FunctionCall fc |
|
||||
this.userInputReturned(fc) and
|
||||
expr = fc and
|
||||
cause = fc.getTarget().getName()
|
||||
)
|
||||
or
|
||||
commandLineArg(expr) and cause = "argv"
|
||||
or
|
||||
expr.(EnvironmentRead).getSourceDescription() = cause
|
||||
}
|
||||
|
||||
/**
|
||||
* This predicate should hold if the expression raises privilege for the
|
||||
* current session. The default definition only holds true for some
|
||||
@@ -152,16 +77,6 @@ class SecurityOptions extends string {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to the argv argument to main().
|
||||
*/
|
||||
private predicate commandLineArg(Expr e) {
|
||||
exists(Parameter argv |
|
||||
argv(argv) and
|
||||
argv.getAnAccess() = e
|
||||
)
|
||||
}
|
||||
|
||||
/** The argv parameter to the main function */
|
||||
predicate argv(Parameter argv) {
|
||||
exists(Function f |
|
||||
@@ -173,21 +88,6 @@ predicate argv(Parameter argv) {
|
||||
/** Convenience accessor for SecurityOptions.isPureFunction */
|
||||
predicate isPureFunction(string name) { exists(SecurityOptions opts | opts.isPureFunction(name)) }
|
||||
|
||||
/** Convenience accessor for SecurityOptions.userInputArgument */
|
||||
deprecated predicate userInputArgument(FunctionCall functionCall, int arg) {
|
||||
exists(SecurityOptions opts | opts.userInputArgument(functionCall, arg))
|
||||
}
|
||||
|
||||
/** Convenience accessor for SecurityOptions.userInputReturn */
|
||||
deprecated predicate userInputReturned(FunctionCall functionCall) {
|
||||
exists(SecurityOptions opts | opts.userInputReturned(functionCall))
|
||||
}
|
||||
|
||||
/** Convenience accessor for SecurityOptions.isUserInput */
|
||||
deprecated predicate isUserInput(Expr expr, string cause) {
|
||||
exists(SecurityOptions opts | opts.isUserInput(expr, cause))
|
||||
}
|
||||
|
||||
/** Convenience accessor for SecurityOptions.isProcessOperationArgument */
|
||||
predicate isProcessOperationArgument(string function, int arg) {
|
||||
exists(SecurityOptions opts | opts.isProcessOperationArgument(function, arg))
|
||||
|
||||
@@ -22,28 +22,4 @@ class CustomSecurityOptions extends SecurityOptions {
|
||||
// for example: (function = "MySpecialSqlFunction" and arg = 0)
|
||||
none() // rules to match custom functions replace this line
|
||||
}
|
||||
|
||||
deprecated override predicate userInputArgument(FunctionCall functionCall, int arg) {
|
||||
SecurityOptions.super.userInputArgument(functionCall, arg)
|
||||
or
|
||||
exists(string fname |
|
||||
functionCall.getTarget().hasGlobalName(fname) and
|
||||
exists(functionCall.getArgument(arg)) and
|
||||
// --- custom functions that return user input via one of their arguments:
|
||||
// 'arg' is the 0-based index of the argument that is used to return user input
|
||||
// for example: (fname = "readXmlInto" and arg = 1)
|
||||
none() // rules to match custom functions replace this line
|
||||
)
|
||||
}
|
||||
|
||||
deprecated override predicate userInputReturned(FunctionCall functionCall) {
|
||||
SecurityOptions.super.userInputReturned(functionCall)
|
||||
or
|
||||
exists(string fname |
|
||||
functionCall.getTarget().hasGlobalName(fname) and
|
||||
// --- custom functions that return user input via their return value:
|
||||
// for example: fname = "xmlReadAttribute"
|
||||
none() // rules to match custom functions replace this line
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user