Model replace and putIfAbsent

This commit is contained in:
Ed Minnix
2023-12-13 12:54:53 -05:00
parent 1544330f3f
commit 709649e9df
3 changed files with 20 additions and 7 deletions

View File

@@ -1,2 +1,2 @@
| TaintedEnvironment.java:28:35:28:55 | new String[] | Command with a relative path 'ls' is executed. |
| TaintedEnvironment.java:39:35:39:55 | new String[] | Command with a relative path 'ls' is executed. |
| Test.java:50:46:50:49 | "ls" | Command with a relative path 'ls' is executed. |

View File

@@ -15,6 +15,17 @@ public class TaintedEnvironment {
pb.environment().put(s, "foo"); // $hasTaintFlow
Map<String, String> extra = Map.of("USER", s);
pb.environment().putAll(extra); // $hasTaintFlow
pb.environment().putIfAbsent("foo", s); // $hasTaintFlow
pb.environment().putIfAbsent(s, "foo"); // $hasTaintFlow
pb.environment().replace("foo", s); // $hasTaintFlow
pb.environment().replace(s, "foo"); // $hasTaintFlow
pb.environment().replace("foo", "bar", s); // $hasTaintFlow
Map<String, String> env = pb.environment();
env.put("foo", s); // $hasTaintFlow