From 36abb8ae8f9bdedff1bdc251c049890026700e59 Mon Sep 17 00:00:00 2001 From: AsamK Date: Wed, 2 Nov 2022 21:17:28 +0100 Subject: [PATCH] Add check for exact path match HttpExchange just checks startsWith, so would also match /api/v1/rpcfoobar --- src/main/java/org/asamk/signal/http/HttpServerHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/asamk/signal/http/HttpServerHandler.java b/src/main/java/org/asamk/signal/http/HttpServerHandler.java index a5213df7..32000a1f 100644 --- a/src/main/java/org/asamk/signal/http/HttpServerHandler.java +++ b/src/main/java/org/asamk/signal/http/HttpServerHandler.java @@ -66,6 +66,10 @@ public class HttpServerHandler { } private void handleRpcEndpoint(HttpExchange httpExchange) throws IOException { + if (!"/api/v1/rpc".equals(httpExchange.getRequestURI().getPath())) { + sendResponse(404, null, httpExchange); + return; + } if (!"POST".equals(httpExchange.getRequestMethod())) { sendResponse(405, null, httpExchange); return;