[CRITICAL] Fix: Add payload size limits and landmark validation to prevent unauthenticated resource exhaustion (#573)#574
Open
namann5 wants to merge 1 commit into
Conversation
…a validation Adds three security hardening measures for WebSocket payload limits: 1. maxHttpBufferSize: 100000 (~100 KB) in Socket.IO config to cap per-message size (prevents oversized frame payloads). 2. Landmarks array upper bound (LANDMARK_COUNT_MAX=33) in pose.validator.js to reject oversized arrays. Also adds hasValidLandmarkObject() to validate each landmark has numeric x/y properties, preventing malformed data from reaching angle computation and session storage. 3. Updated tests to reflect new validation requirements. Fixes Somil450#573
|
@namann5 is attempting to deploy a commit to the somiljain2024-4175's projects Team on Vercel. A member of the Team first needs to authorize it. |
11 tasks
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.
📌 Related Issue
Fixes #573
📝 Description
This PR fixes a critical resource exhaustion vulnerability (CVSS 7.5) in the WebSocket frame handler. The server accepted unauthenticated connections with no upper bound on landmarks array size and no per-message size limit, allowing an attacker to exhaust server memory and disk space.
🔹 What has been changed?
server/src/config/socket.js — Added \maxHttpBufferSize: 100000\ (~100 KB) to Socket.IO configuration to cap per-message payload size. Previously the Socket.IO default (1 MB) was used, enabling 60 MB/s throughput per connection.
server/src/modules/pose/pose.validator.js —
Updated test — \pose.validator.test.js\ now tests upper bound (rejects 34), lower bound (rejects 28), landmark shape validation (rejects missing/non-numeric properties), and valid 29–33 range.
🔹 Why are these changes needed?
Without these limits:
🛠️ Type of Change
🧪 Testing