Skip to content

Commit 2b2e651

Browse files
authored
do not extract endpoint from path for 404s (#1069)
This can lead to a large set of endpoints for things like security scans. Logs should be used to track down those paths.
1 parent 7953113 commit 2b2e651

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ private IpcAttemptFinal getAttemptFinal() {
639639

640640
private String getEndpoint() {
641641
return (endpoint == null)
642-
? (path == null) ? "unknown" : PathSanitizer.sanitize(path)
642+
? (path == null || httpStatus == 404) ? "unknown" : PathSanitizer.sanitize(path)
643643
: endpoint;
644644
}
645645

spectator-ext-ipc/src/test/java/com/netflix/spectator/ipc/IpcLogEntryTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ public void endpointViaUri() {
225225
Assertions.assertEquals("_api_v1_-", actual);
226226
}
227227

228+
@Test
229+
public void endpointViaUri404() {
230+
String path = "/api/v1/1234567890";
231+
String actual = (String) entry
232+
.withUri(URI.create(path))
233+
.withHttpStatus(404)
234+
.convert(this::toMap)
235+
.get("endpoint");
236+
Assertions.assertEquals("unknown", actual);
237+
}
238+
228239
@Test
229240
public void clientNode() {
230241
String expected = "i-12345";

0 commit comments

Comments
 (0)