Skip to content

Fix/ghsa vw7q websocket json depth - #632

Open
wsobel wants to merge 4 commits into
mainfrom
fix/ghsa-vw7q-websocket-json-depth
Open

wsobel wants to merge 4 commits into
mainfrom
fix/ghsa-vw7q-websocket-json-depth

Conversation

@wsobel

@wsobel wsobel commented Dec 1, 2026

Copy link
Copy Markdown
Member

This PR addresses https://github.com/mtconnect/cppagent/security/advisories/GHSA-vw7q-qc2r-cf92

Every text message that arrives on a WebSocket connection is parsed with RapidJSON's default parser, which is recursive: it calls itself once for every level of nesting. The agent sets no limit on nesting. A message that consists of about 175,000 or more opening square brackets uses up the 8 MiB stack of the worker thread, and the agent process ends with a segmentation fault.

wsobel and others added 3 commits November 27, 2026 16:22
jiro4989/build-deb-action runs a prebuilt amd64-only Docker image, which
fails on the ubuntu-22.04-arm runner with a platform mismatch. Generate the
DEBIAN/control file and call dpkg-deb directly instead; the step still
exposes file_name for the release upload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bSocket JSON

Parse WebSocket requests with RapidJSON's iterative parser so nesting depth
no longer consumes worker-thread stack; a ~200 kB message of '[' could crash
the agent. Apply the same flag to the entity and device JSON parsers.

Also validate array parameters in WebSocket requests: non-string elements
were read with GetString() and could segfault, and an empty array threw
instead of producing an empty value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wsobel
wsobel requested a review from simonyg December 3, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants