mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Python: remove support for capturing callbacks
This will be added in a follow-up PR instead.
This commit is contained in:
@@ -37,45 +37,6 @@ abstract class SummarizedCallable extends LibraryCallable, Impl::Public::Summari
|
|||||||
|
|
||||||
deprecated class RequiredSummaryComponentStack = Impl::Private::RequiredSummaryComponentStack;
|
deprecated class RequiredSummaryComponentStack = Impl::Private::RequiredSummaryComponentStack;
|
||||||
|
|
||||||
private module LibraryCallbackSummaries {
|
|
||||||
private predicate libraryCall(CallCfgNode call) {
|
|
||||||
not exists(NormalCall normalCall | call.getNode() = normalCall.getNode())
|
|
||||||
}
|
|
||||||
|
|
||||||
private DataFlow::LocalSourceNode trackLambdaCreation(TypeTracker t) {
|
|
||||||
t.start() and
|
|
||||||
lambdaCreation(result, _, _)
|
|
||||||
or
|
|
||||||
exists(TypeTracker t2 | result = trackLambdaCreation(t2).track(t2, t)) and
|
|
||||||
not result.(ParameterNode).getParameter().isSelf()
|
|
||||||
}
|
|
||||||
|
|
||||||
private predicate libraryCallHasLambdaArg(CallCfgNode call, int i) {
|
|
||||||
exists(CfgNode arg |
|
|
||||||
arg = call.getArg(i) and
|
|
||||||
arg.getALocalSource() = trackLambdaCreation(TypeTracker::end()) and
|
|
||||||
libraryCall(call)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private class LibraryLambdaMethod extends SummarizedCallable {
|
|
||||||
LibraryLambdaMethod() { this = "<library method accepting a callback>" }
|
|
||||||
|
|
||||||
final override CallCfgNode getACall() { libraryCallHasLambdaArg(result, _) }
|
|
||||||
|
|
||||||
final override ArgumentNode getACallback() { none() }
|
|
||||||
|
|
||||||
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
|
|
||||||
exists(int i |
|
|
||||||
i in [0 .. 10] and
|
|
||||||
input = "Argument[" + i + "]" and
|
|
||||||
output = "Argument[" + i + "].Parameter[lambda-self]"
|
|
||||||
) and
|
|
||||||
preservesValue = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SummarizedCallableFromModel extends SummarizedCallable {
|
private class SummarizedCallableFromModel extends SummarizedCallable {
|
||||||
string type;
|
string type;
|
||||||
string path;
|
string path;
|
||||||
|
|||||||
@@ -45,4 +45,4 @@ def test_library_call():
|
|||||||
for x in map(set, [1]):
|
for x in map(set, [1]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
SINK(captured["x"]) #$ captured
|
SINK(captured["x"]) #$ MISSING: captured
|
||||||
|
|||||||
Reference in New Issue
Block a user