fix: remove VITE_SOCKET_AUTH_TOKEN shared secret exposure from client bundle#925
Open
namann5 wants to merge 4 commits into
Open
fix: remove VITE_SOCKET_AUTH_TOKEN shared secret exposure from client bundle#925namann5 wants to merge 4 commits into
namann5 wants to merge 4 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)
…lient bundle The SOCKET_AUTH_TOKEN was exposed to all users via a VITE_* env variable that gets embedded in the client bundle at build time, making it publicly visible. This completely defeats shared-secret WebSocket authentication. Changes: - Remove VITE_SOCKET_AUTH_TOKEN from .env.example — shared secrets must never use the VITE_* prefix (reserved for public env vars) - Rewrite src/hooks/useWorkoutWebSocket.ts to send the Firebase Auth ID token via firebaseToken query param instead of the shared SOCKET_AUTH_TOKEN - Harden server/src/app/createServer.js to reject socket.handshake.query?.token (URL query parameters leak in server logs, browser history, and referer headers) - Update API.md and ARCHITECTURE.md to document the new auth model Browser clients now authenticate with per-user Firebase ID tokens. SOCKET_AUTH_TOKEN remains available for machine-to-machine / proxy auth.
|
@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.
No description provided.