-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.x] Add Message Payload Validation and Improve Channel Data Handling (
#303) * fix: ensure channel_data is string before json decoding Adds type checking for channel_data to prevent JSON decode errors when the data is not a string format, improving the robustness of message handling in the CLI logger. * feat: add message payload validation in WebSocket server Add comprehensive validation for incoming WebSocket messages using Laravel Validator to: - Ensure correct message structure and data types - Prevent malformed data from causing server errors - Validate required fields (event, data.channel) - Enforce JSON format for channel_data - Improve overall server stability and security This change helps prevent server crashes and unexpected behavior caused by invalid message formats. * test: add validation test cases for WebSocket message payloads Add comprehensive test coverage for message payload validation including: - Event type validation - Data structure validation - Channel format validation - Auth data type checking - Channel data format verification Each test case ensures proper error responses for invalid message formats, maintaining consistency with Pusher protocol specifications. * updates validation * update validation * remove breaking change --------- Co-authored-by: Joe Dixon <[email protected]>
- Loading branch information
1 parent
c3a4961
commit c55c36a
Showing
5 changed files
with
182 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
For client events, should the data not be array|string?
Pusher Client Events