Python: remove support for capturing callbacks

This will be added in a follow-up PR instead.
This commit is contained in:
Rasmus Lerchedahl Petersen
2023-12-18 23:24:57 +01:00
parent 6e4011d2ae
commit 78c484faab
2 changed files with 1 additions and 40 deletions

View File

@@ -37,45 +37,6 @@ abstract class SummarizedCallable extends LibraryCallable, Impl::Public::Summari
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 {
string type;
string path;

View File

@@ -45,4 +45,4 @@ def test_library_call():
for x in map(set, [1]):
pass
SINK(captured["x"]) #$ captured
SINK(captured["x"]) #$ MISSING: captured