]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(simulator): reject supervision URLs that break once the station identity is appen...
authorVitor Coelho <6161176+VitorCoelho@users.noreply.github.com>
Fri, 30 Oct 2026 14:59:19 +0000 (14:59 +0000)
committerGitHub <noreply@github.com>
Fri, 30 Oct 2026 14:59:19 +0000 (14:59 +0000)
commit635362f66e7a5d56850ed1fb2c9714f04b9c0953
treef8e2f3c0421839267262b6cbcc5cb8e1540d4f1b
parent8e01c4471810005acf77c5406eecb3c7f84a6be9
fix(simulator): reject supervision URLs that break once the station identity is appended (#2168)

* fix(simulator): reject supervision URLs that break once the station identity is appended

The charging station dials the supervision URL with its identity appended.
After a trailing '#' the identity becomes a fragment, which the ws client
rejects, and a ws+unix URL without a ':' between the socket path and the
request path gets the identity appended to the socket path, so the
connection fails (ENOTDIR). Reject both in SupervisionUrlSchema.

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* test(utils): check the supervision URL schema against the URL the station dials

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* docs(readme): document the ws+unix supervision URL form

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* fix(simulator): reject supervision URLs with a query string or an ambiguous ws+unix separator

The charging station identity is appended to the supervision URL, so after
a '?' it lands in the query (ws://h/ocpp?a=b dials /ocpp with query
'a=b/CS-1'). ws keeps only the first two ':'-separated parts of a ws+unix
pathname, so 'ws+unix:///s.sock:/oc:pp' dials /oc, and 'ws+unix:///:/ocpp'
dials the socket '/'. Reject these, checked against real TCP and Unix-socket
servers.

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* test(utils): cover query strings and extra ws+unix separators in supervision URLs

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* docs(readme): document the query string and ws+unix separator rules for supervision URLs

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* fix(simulator): accept one-character ws+unix socket paths and require a '/' request path

A relative socket path such as 's' in 'ws+unix:s:/OCPP16' is valid, so
require a socket path other than '/' instead of two characters. A request
path without a leading '/' (ws+unix:s:OCPP16) makes the server answer 400,
so require it to be empty or to start with '/'.

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
* test(utils): cover one-character ws+unix socket paths and request paths without '/'

Regressions for the SupervisionUrlSchema fix: 'ws+unix:s:/OCPP16' and
'ws+unix:./s:/OCPP16' are accepted, 'ws+unix:s:OCPP16' and
'ws+unix:///tmp/simulator.sock:OCPP16' are rejected.

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
---------

Signed-off-by: VitorCoelho <vitorc195@gmail.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
README.md
src/utils/ConfigurationSchema.ts
tests/utils/ConfigurationSchema.test.ts