|
12 | 12 | import java.util.Collection;
|
13 | 13 | import java.util.Collections;
|
14 | 14 | import java.util.Enumeration;
|
| 15 | +import java.util.HashMap; |
15 | 16 | import java.util.Iterator;
|
16 | 17 | import java.util.List;
|
17 | 18 | import java.util.Map;
|
@@ -54,8 +55,37 @@ public class Test {
|
54 | 55 | Properties newPropertiesWithMapKey(Object element) { Properties p = new Properties(); p.put(element, null); return p; }
|
55 | 56 | // Object newWithMapValue(Object element) { return null; }
|
56 | 57 | Properties newPropertiesWithMapValue(Object element) { Properties p = new Properties(); p.put(null, element); return p; }
|
57 |
| - Object source() { return null; } |
58 |
| - void sink(Object o) { } |
| 58 | + static Object source() { return null; } |
| 59 | + static void sink(Object o) { } |
| 60 | + |
| 61 | + // Test AntPathMatcher's protected methods: |
| 62 | + private static class AntPathMatcherTest extends AntPathMatcher { |
| 63 | + |
| 64 | + public void test() throws Exception { |
| 65 | + { |
| 66 | + // "org.springframework.util;AntPathMatcher;false;doMatch;;;Argument[1];MapValue of Argument[3];taint" |
| 67 | + Map<String, String> out = new HashMap<>(); |
| 68 | + String in = (String)source(); |
| 69 | + this.doMatch("somePattern", in, true, out); |
| 70 | + sink(out.get("someKey")); // $hasTaintFlow |
| 71 | + } |
| 72 | + { |
| 73 | + // "org.springframework.util;AntPathMatcher;false;tokenizePath;;;Argument[0];ArrayValue of ReturnValue;taint", |
| 74 | + String[] out = null; |
| 75 | + String in = (String)source(); |
| 76 | + out = this.tokenizePath(in); |
| 77 | + sink(out[0]); // $hasTaintFlow |
| 78 | + } |
| 79 | + { |
| 80 | + // "org.springframework.util;AntPathMatcher;false;tokenizePattern;;;Argument[0];ArrayValue of ReturnValue;taint", |
| 81 | + String[] out = null; |
| 82 | + String in = (String)source(); |
| 83 | + out = this.tokenizePattern(in); |
| 84 | + sink(out[0]); // $hasTaintFlow |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + } |
59 | 89 |
|
60 | 90 | public void test() throws Exception {
|
61 | 91 |
|
|
0 commit comments