Skip to content

Commit 901631c

Browse files
committed
Ratpack Promise add support for apply method
1 parent b9dc3d0 commit 901631c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

java/ql/src/semmle/code/java/frameworks/ratpack/RatpackExec.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract private class SimpleFluentLambdaMethod extends FluentLambdaMethod {
5454
private class RatpackPromiseMapMethod extends SimpleFluentLambdaMethod {
5555
RatpackPromiseMapMethod() {
5656
getDeclaringType() instanceof RatpackPromise and
57-
hasName(["map", "flatMap", "blockingMap"])
57+
hasName(["map", "flatMap", "blockingMap", "apply"])
5858
}
5959

6060
override predicate consumesTaint(int lambdaArg) { lambdaArg = 0 }

java/ql/test/library-tests/frameworks/ratpack/resources/Resource.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,24 @@ void test8() {
189189
sink(value); //$hasTaintFlow
190190
});
191191
}
192+
193+
void test9() {
194+
String tainted = taint();
195+
Promise
196+
.value(tainted)
197+
.apply(Resource::identity)
198+
.then(value -> {
199+
sink(value); //$hasTaintFlow
200+
});
201+
Promise
202+
.value("potato")
203+
.apply(Resource::identity)
204+
.then(value -> {
205+
sink(value); // no taints flow
206+
});
207+
}
208+
209+
public static Promise<String> identity(Promise<String> input) {
210+
return input.map(i -> i);
211+
}
192212
}

java/ql/test/stubs/ratpack-1.9.x/ratpack/exec/Promise.java

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)