mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Python: add a flow summary
we could consider adding non-value-preserving flow from input to output
This commit is contained in:
24
python/ql/lib/semmle/python/frameworks/Builtins.qll
Normal file
24
python/ql/lib/semmle/python/frameworks/Builtins.qll
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Provides classes modeling security-relevant aspects of built-ins.
|
||||
*/
|
||||
|
||||
import python
|
||||
private import semmle.python.dataflow.new.FlowSummary
|
||||
private import semmle.python.ApiGraphs
|
||||
|
||||
/** A flow summary for `reversed`. */
|
||||
class ReversedSummary extends SummarizedCallable {
|
||||
ReversedSummary() { this = "builtins.reversed" }
|
||||
|
||||
override CallNode getACall() { result = API::builtin("reversed").getACall().getNode() }
|
||||
|
||||
override DataFlow::ArgumentNode getACallback() {
|
||||
result = API::builtin("reversed").getAValueReachableFromSource()
|
||||
}
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[0].ListElement" and
|
||||
output = "ReturnValue.ListElement" and
|
||||
preservesValue = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user