[ZEPPELIN-6646] validate websocket payloads - #5453
Open
gyowoo1113 wants to merge 5 commits into
Open
Conversation
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.
What is this PR for?
WebSocket payloads are currently trusted after checking only the operation name.
Message.receive()mapsmessage.datato its declared TypeScript type without runtime validation, so malformed payloads can reach component handlers unchanged.This PR adds an OP-based runtime payload guard convention at the SDK receive boundary. Guards are registered only for operations with a demonstrated payload failure, rather than auditing or validating every WebSocket message up front.
Message.receive()was chosen as the validation boundary because it already has both the OP and payload before the data is passed to subscribers, while keeping the existing interceptor contract unchanged.LIST_UPDATE_NOTE_JOBSis the first guarded operation becauseZEPPELIN-6551demonstrated a concrete failure around partial job-removal payloads in the Job Manager. The guard preserves valid removal stubs and filters malformed non-removal updates before they reach subscribers. Additional OPs can be added to the registry when a concrete runtime failure demonstrates the need for validation.It also catches errors thrown by
@MessageListenerhandlers and logs them with the corresponding OP so the failure can be attributed to the WebSocket operation that triggered it.ZEPPELIN-6645was considered as part of the validation boundary. An emptyinterpreterSettingsarray is a legitimate server response when the user is not authorized for any interpreter setting. Since the payload shape itself is valid, the non-empty assumption belongs to the note-create handler rather than the WebSocket validation layer, so this PR does not add a shared payload guard for that case.What type of PR is it?
Bug Fix
Todos
LIST_UPDATE_NOTE_JOBSMessage.receive()@MessageListenerhandler errors and log the corresponding OPWhat is the Jira issue?
[ZEPPELIN-6646]
How should this be tested?
cd zeppelin-web-angular npm run test:shell -- message.spec.ts npm run test:shell -- message-listener.spec.tsBoth test suites pass successfully.
Screenshots (if appropriate)
N/A
Questions: