File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
lib/semmle/code/java/frameworks/ratpack
test/library-tests/frameworks/ratpack/resources Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ private class RatpackExecModel extends SummaryModelCsv {
2222 "blockingMap;;;Element of Argument[-1];Parameter[0] of Argument[0];value" ,
2323 "blockingMap;;;ReturnValue of Argument[0];Element of ReturnValue;value" ,
2424 "mapError;;;ReturnValue of Argument[0];Element of ReturnValue;value" ,
25+ // `apply` passes the qualifier to the function as the first argument
26+ "apply;;;Element of Argument[-1];Element of Parameter[0] of Argument[0];value" ,
27+ "apply;;;Element of ReturnValue of Argument[0];Element of ReturnValue;value" ,
2528 // `Promise` termination method
2629 "then;;;Element of Argument[-1];Parameter[0] of Argument[0];value" ,
2730 // 'next' accesses qualfier the 'Promise' value and also returns the qualifier
Original file line number Diff line number Diff line change @@ -230,6 +230,26 @@ public static String identity(String input) {
230230 }
231231
232232 void test10 () {
233+ String tainted = taint ();
234+ Promise
235+ .value (tainted )
236+ .apply (Resource ::promiseIdentity )
237+ .then (value -> {
238+ sink (value ); //$hasTaintFlow
239+ });
240+ Promise
241+ .value ("potato" )
242+ .apply (Resource ::promiseIdentity )
243+ .then (value -> {
244+ sink (value ); // no taints flow
245+ });
246+ }
247+
248+ public static Promise <String > promiseIdentity (Promise <String > input ) {
249+ return input .map (i -> i );
250+ }
251+
252+ void test11 () {
233253 String tainted = taint ();
234254 Promise
235255 .value (tainted )
@@ -245,7 +265,7 @@ void test10() {
245265 });
246266 }
247267
248- void test11 () {
268+ void test12 () {
249269 String tainted = taint ();
250270 Promise
251271 .sync (() -> tainted )
You can’t perform that action at this time.
0 commit comments