Skip to content

Commit

Permalink
do not extract endpoint from path for 404s (#1069)
Browse files Browse the repository at this point in the history
This can lead to a large set of endpoints for things
like security scans. Logs should be used to track down
those paths.
  • Loading branch information
brharrington authored Aug 2, 2023
1 parent 7953113 commit 2b2e651
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ private IpcAttemptFinal getAttemptFinal() {

private String getEndpoint() {
return (endpoint == null)
? (path == null) ? "unknown" : PathSanitizer.sanitize(path)
? (path == null || httpStatus == 404) ? "unknown" : PathSanitizer.sanitize(path)
: endpoint;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,17 @@ public void endpointViaUri() {
Assertions.assertEquals("_api_v1_-", actual);
}

@Test
public void endpointViaUri404() {
String path = "/api/v1/1234567890";
String actual = (String) entry
.withUri(URI.create(path))
.withHttpStatus(404)
.convert(this::toMap)
.get("endpoint");
Assertions.assertEquals("unknown", actual);
}

@Test
public void clientNode() {
String expected = "i-12345";
Expand Down

0 comments on commit 2b2e651

Please sign in to comment.