mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Ratpack Promise add support for apply method
This commit is contained in:
@@ -54,7 +54,7 @@ abstract private class SimpleFluentLambdaMethod extends FluentLambdaMethod {
|
||||
private class RatpackPromiseMapMethod extends SimpleFluentLambdaMethod {
|
||||
RatpackPromiseMapMethod() {
|
||||
getDeclaringType() instanceof RatpackPromise and
|
||||
hasName(["map", "flatMap", "blockingMap"])
|
||||
hasName(["map", "flatMap", "blockingMap", "apply"])
|
||||
}
|
||||
|
||||
override predicate consumesTaint(int lambdaArg) { lambdaArg = 0 }
|
||||
|
||||
@@ -189,4 +189,24 @@ class Resource {
|
||||
sink(value); //$hasTaintFlow
|
||||
});
|
||||
}
|
||||
|
||||
void test9() {
|
||||
String tainted = taint();
|
||||
Promise
|
||||
.value(tainted)
|
||||
.apply(Resource::identity)
|
||||
.then(value -> {
|
||||
sink(value); //$hasTaintFlow
|
||||
});
|
||||
Promise
|
||||
.value("potato")
|
||||
.apply(Resource::identity)
|
||||
.then(value -> {
|
||||
sink(value); // no taints flow
|
||||
});
|
||||
}
|
||||
|
||||
public static Promise<String> identity(Promise<String> input) {
|
||||
return input.map(i -> i);
|
||||
}
|
||||
}
|
||||
@@ -113,4 +113,8 @@ public interface Promise<T> {
|
||||
default Promise<T> fork() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default <O> Promise<O> apply(Function<? super Promise<T>, ? extends Promise<O>> function) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user