Skip to content

Fix/issue 6 websocket auth#19

Merged
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/issue-6-websocket-auth
Nov 27, 2025
Merged

Fix/issue 6 websocket auth#19
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/issue-6-websocket-auth

Conversation

@DevanshuNEU

Copy link
Copy Markdown
Collaborator

🎯 Summary

WebSocket endpoint was accepting connections without authentication - anyone could trigger indexing jobs and burn API credits. Now requires JWT token via query param.

Fixes #6

🔄 Type

  • 🐛 Bug fix

🧪 Tested?

  • Tests pass (make test) - 31/31
  • Manually verified with Docker - unauthenticated connections rejected

Changes

  • Added authenticate_websocket() helper in main.py
  • WebSocket rejects with 4001 (no/invalid token) or 4004 (repo not found)
  • Added 6 new tests for WebSocket auth
  • Improved Makefile with make dev/stop/test commands

- Add authenticate_websocket() helper for token validation via query param
- Reject connections without token (4001) or with invalid token (4001)
- Validate repo exists before accepting connection (4004)
- Add TODO for repo ownership validation (needs user_id column)
- Add unit tests for WebSocket authentication
- Configure pytest for async tests

Fixes #6
- Add make dev/stop/clean/health commands
- Add make test/test-ws for running tests
- Add .env.dev and .env.prod to gitignore
- Simplify local development setup
@vercel

vercel Bot commented Nov 27, 2025

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Nov 27, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
opencodeintel Ready Ready Preview Comment Nov 27, 2025 5:21am

@DevanshuNEU DevanshuNEU merged commit f7739e0 into OpenCodeIntel:main Nov 27, 2025
6 checks passed
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.

[SECURITY] WebSocket endpoint has no authentication

1 participant