Add one sanity check at UI server incoming requests handling
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 1 Aug 2022 13:55:57 +0000 (15:55 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 1 Aug 2022 13:55:57 +0000 (15:55 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ui-server/ui-services/AbstractUIService.ts

index a26af3967ccc35f192111f2d8b44d4e778249a8a..b2805ba668b70651c45a6eb19310d4f54fc088a5 100644 (file)
@@ -35,6 +35,10 @@ export default abstract class AbstractUIService {
     } else {
       throw new BaseError('UI protocol request is not iterable');
     }
+    // TODO: should probably be moved to the ws verify clients callback
+    if (protocolRequest.length !== 3) {
+      throw new BaseError('UI protocol request is malformed');
+    }
     let messageResponse: JsonType;
     if (this.messageHandlers.has(command)) {
       try {