Skip to content

Commit ad1e941

Browse files
committed
Last reverts to not pass operation anymore to the URLCollector
1 parent a6905ce commit ad1e941

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

agent/src/main/java/dev/aikido/agent/wrappers/HttpURLConnectionWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static void before(
5353
// Run report with "argument"
5454
for (Method method2: clazz.getMethods()) {
5555
if(method2.getName().equals("report")) {
56-
method2.invoke(null, url, "HttpUrlConnection");
56+
method2.invoke(null, url);
5757
break;
5858
}
5959
}

agent/src/main/java/dev/aikido/agent/wrappers/OkHttpWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void before(
5050
URL url = (URL) toUrlMethod.invoke(urlObject);
5151

5252
// Report the URL
53-
URLCollector.report(url, "okhttp3.OkHttpClient.newCall");
53+
URLCollector.report(url);
5454
}
5555
}
5656
}

agent_api/src/test/java/vulnerabilities/ssrf/SSRFDetectorTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public void testSsrfDetectorWithRedirectTo127IP() throws MalformedURLException {
5555
// Setup context :
5656
setContextAndLifecycle("http://ssrf-redirects.testssandbox.com/ssrf-test");
5757

58-
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), "test");
59-
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://127.0.0.1:8080"), "test");
58+
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"));
59+
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://127.0.0.1:8080"));
6060
Attack attackData = SSRFDetector.run(
6161
"127.0.0.1", 8080,
6262
List.of("127.0.0.1"),
@@ -79,8 +79,8 @@ public void testSsrfDetectorWithRedirectTo127IPButHostnameCapitalizationDifferen
7979
// Setup context :
8080
setContextAndLifecycle("http://Ssrf-redirects.testssandbox.com/ssrf-test");
8181

82-
URLCollector.report(new URL("http://Ssrf-redirects.testssandbox.com/ssrf-test"), "test");
83-
RedirectCollector.report(new URL("http://ssrf-Redirects.testssandbox.com/ssrf-test"), new URL("http://127.0.0.1:8080"), "test");
82+
URLCollector.report(new URL("http://Ssrf-redirects.testssandbox.com/ssrf-test"));
83+
RedirectCollector.report(new URL("http://ssrf-Redirects.testssandbox.com/ssrf-test"), new URL("http://127.0.0.1:8080"));
8484
Attack attackData = SSRFDetector.run(
8585
"127.0.0.1", 8080,
8686
List.of("127.0.0.1"),
@@ -103,8 +103,8 @@ public void testSsrfDetectorWithRedirectToLocalhost() throws MalformedURLExcepti
103103
// Setup context :
104104
setContextAndLifecycle("http://ssrf-redirects.testssandbox.com/");
105105

106-
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), "test");
107-
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"), "test");
106+
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"));
107+
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"));
108108
Attack attackData = SSRFDetector.run(
109109
"localhost", 80,
110110
List.of("127.0.0.1"),
@@ -130,8 +130,8 @@ public void testSsrfDetectorWithRedirectToLocalhostButIsRequestToItself() throws
130130
"http://ssrf-redirects.testssandbox.com/examplesite")); // url
131131

132132

133-
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), "test");
134-
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"), "test");
133+
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"));
134+
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"));
135135
Attack attackData = SSRFDetector.run(
136136
"localhost", 80,
137137
List.of("127.0.0.1"),
@@ -147,8 +147,8 @@ public void testSsrfDetectorWithServiceHostnameInRedirect() throws MalformedURLE
147147
// Setup context :
148148
setContextAndLifecycle("http://mysql-database/ssrf-test");
149149

150-
URLCollector.report(new URL("http://mysql-database/ssrf-test"), "test");
151-
RedirectCollector.report(new URL("http://mysql-database/ssrf-test"), new URL("http://127.0.0.1:8080"), "test");
150+
URLCollector.report(new URL("http://mysql-database/ssrf-test"));
151+
RedirectCollector.report(new URL("http://mysql-database/ssrf-test"), new URL("http://127.0.0.1:8080"));
152152
Attack attackData = SSRFDetector.run(
153153
"127.0.0.1", 8080,
154154
List.of("127.0.0.1"),
@@ -164,8 +164,8 @@ public void testSsrfDetectorForcedProtectionOff() throws MalformedURLException {
164164
// Setup context :
165165
setContextAndLifecycle("http://ssrf-redirects.testssandbox.com/", "/api2/forced-off-route");
166166

167-
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), "test");
168-
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"), "test");
167+
URLCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"));
168+
RedirectCollector.report(new URL("http://ssrf-redirects.testssandbox.com/ssrf-test"), new URL("http://localhost"));
169169
Attack attackData = SSRFDetector.run(
170170
"localhost", 80,
171171
List.of("127.0.0.1"),

0 commit comments

Comments
 (0)