Repository navigation
fix(api): an exec control message is checked flat before any transformation (closes #472) - #481
Merged
Merged
Conversation
…mation (closes #472) Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
… the shape check is what guards Review of #481: the catch around the control-frame check hid any throw from it, so the SPEC's failed end never happened and the tests passed without the flat check. Only JSON parsing is caught now; the tests call the check directly, join a second session on the same server, and cover the failed end. Signed-off-by: samuel mbabhazi <[email protected]>
Collaborator
Author
|
Code review (high), three findings, all fixed in 2cc2663:
Exec socket tests: 14/14 pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #472 (P1, from the 2026-11-25 security audit).
What was wrong
7dba097 (#457) validated the browser's control messages with
class-validatorDTOs. It calledplainToInstanceon the whole parsed object, so an unexpected field with deep nesting was walked recursively. An 18 KB message, well under the 64 KiBmaxPayload, threwRangeError: Maximum call stack size exceeded(reproduced here).browserFramecaught onlyJSON.parse, and the WebSocketmessagelistener had no boundary, so the error could escape to the process.What changed
controlFramechecks the shape first, flat. Aresizemust have exactlytype,colsandrows, acloseexactlytypeandkill, each a primitive of the expected type. Only those values are copied into the DTO. The transformation therefore never sees anything the browser nested, and a message with an extra key is ignored like any other unknown one.browserFramewraps parsing and validation together: nesting past what the parser takes is no frame either.messagelistener has an exception boundary. If a message ever throws, it logs a warning naming the session only, never the message, and ends that session asfailed. The process and the other sessions go on.How it was tested
resizeandclose, 30 000 nested arrays, an extra flat key, and aconstructor/prototypekey. All are under 64 KiB and all are ignored without throwing. The existing malicious-input cases still pass.exec-socket.spec.ts): a session sends the nested message, then a valid resize. The resize reaches the agent, and a second session on another server instance still joins. Before this change, that test hung on the uncaught error and the unit test threwRangeError.nx typecheck lintfor the API.Security considerations
This closes an authenticated availability hole: someone with
container.execand an open session could bring the shared control plane down. Nothing about the message or the session's credentials is logged.