Skip to content

fix: remove VITE_SOCKET_AUTH_TOKEN shared secret exposure from client bundle#925

Open
namann5 wants to merge 4 commits into
Somil450:mainfrom
namann5:fix/exposed-socket-auth-token-client-bundle
Open

fix: remove VITE_SOCKET_AUTH_TOKEN shared secret exposure from client bundle#925
namann5 wants to merge 4 commits into
Somil450:mainfrom
namann5:fix/exposed-socket-auth-token-client-bundle

Conversation

@namann5

@namann5 namann5 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

namann5 added 4 commits May 27, 2026 20:48
- 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
…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.
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant