Skip to content

Read clientName among other query parameters - #59

Merged
slominskir merged 1 commit into
mainfrom
fix-client-name-parsing
Oct 5, 2026
Merged

slominskir merged 1 commit into
mainfrom
fix-client-name-parsing

Conversation

@slominskir-coding-agent

Copy link
Copy Markdown
Contributor

What changed

MonitorEndpoint.onOpen read clientName by splitting the whole query string on =, and kept the result only if that gave exactly two parts. It never checked the parameter's name. So:

  • a client that sent any other parameter, such as ?a=1&clientName=x, lost its name;
  • ?foo=bar named the client bar;
  • a malformed escape, such as clientName=%zz, made URLDecoder throw IllegalArgumentException out of onOpen.

The parsing moves to MonitorEndpoint.clientName(query). It finds the clientName parameter among any others and decodes it as UTF-8; a missing or malformed one gives an empty name, as a missing one did before.

epics2web.js appended ?clientName= even when the url option already had a query string, which made exactly the query that broke. It now appends with & then. With the default url, which has no query string, the result is the same as before.

This was noticed while adding the disconnected PVs report (#58), which shows clients by name. WEDM and the default epics2web.js send no other parameters, so they weren't affected.

Deployment

None.

Checks

  • ./gradlew spotlessCheck test: passed, 84 unit tests. 3 are new, in MonitorEndpointTest: other parameters in any order, decoding an encoded page address, and missing, empty or malformed names.
  • ./gradlew integrationTest, after rebuilding the image: passed, 26 tests. 1 is new, in ClientNameTest: the console shows a name that contains = and & and is sent between other parameters.
  • Not run: the JS change wasn't tried in a browser. It's a one-line change, and the build minified it without errors.

🤖 Generated with Claude Code

The WebSocket endpoint read the client's name by splitting the whole
query string on "=", and kept it only if that gave exactly two parts,
without checking the parameter's name. A client that sent any other
parameter lost its name, and a malformed escape threw out of onOpen.
It now finds the clientName parameter among the others, and a
malformed one gives an empty name.

epics2web.js appended "?clientName=" even to a url option that already
had a query string; it now appends with "&" then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slominskir
slominskir merged commit 380e814 into main Oct 5, 2026
6 checks passed
@slominskir
slominskir deleted the fix-client-name-parsing branch October 5, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

source::ai Work done by an AI agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant