]> nmode's Git Repositories - signal-cli/commitdiff
Add check for exact path match
authorAsamK <asamk@gmx.de>
Wed, 2 Nov 2022 20:17:28 +0000 (21:17 +0100)
committerAsamK <asamk@gmx.de>
Wed, 2 Nov 2022 20:17:28 +0000 (21:17 +0100)
HttpExchange just checks startsWith, so would also match /api/v1/rpcfoobar

src/main/java/org/asamk/signal/http/HttpServerHandler.java

index a5213df7a0e80f71dea2a8798946dfe6f39d5347..32000a1f4db86096ea155ea86432b601ab743b8a 100644 (file)
@@ -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;