fix: prevent prototype pollution via session archive decompression (closes #922)#923
Open
namann5 wants to merge 3 commits into
Open
fix: prevent prototype pollution via session archive decompression (closes #922)#923namann5 wants to merge 3 commits into
namann5 wants to merge 3 commits into
Conversation
- Add SOCKET_AUTH_TOKEN middleware for Socket.IO authentication - Enforce per-IP connection limits via MAX_CONNECTIONS_PER_IP - Rate-limit pose frames to MAX_FRAMES_PER_SEC per connection - Parse comma-separated CORS origins with production wildcard warning - Add unit tests for cors config, socket config, and frame rate limiting - Add integration tests for socket auth (reject, accept, unset) - Bump socket.io-client 4.8.1→4.8.3, supertest 7.0.0→7.2.2
…p + scoped ipConnectionCount)
|
@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. |
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.
Description
This PR fixes a critical prototype pollution vulnerability (CWE-1321) discovered in the session archive decompression pipeline.
Vulnerabilities Fixed
1. Prototype Pollution in sessionRecorder.ts - RLDCompressionDriver.applyDelta()
The
ensureLandmark()method indexed into the landmarks array usingentry.indexwithout validating the index type or bounds. A malicious archive withindex: "__proto__"would:Array.prototypeinstead of a landmark objectObject.prototypevia property assignmentFix: Added
isSafeIndex()guard (validates non-negative integer < 10000) andisSafeKey()guard (filters__proto__,constructor,prototypekeys).2. Missing Input Sanitization in workoutSyncService.ts
Multiple functions spread external
WorkoutRecordobjects (saveWorkoutLocally,markWorkoutAsSynced,updateLocalWorkoutsFromFirestore) without sanitizing against prototype pollution keys.Fix: Added
sanitizeRecord()helper that strips dangerous keys before object spread operations.Changes
isSafeIndex(),isSafeKey(), guardedensureLandmark()andapplyDelta()property accesssanitizeRecord(), applied to all object spread operations from external dataTesting
isSafeIndexrejects strings, negative numbers, floats, and values >= 10000isSafeKeyrejects__proto__,constructor,prototypeCloses #922