FastAPI CORSMiddleware ignores WebSocket handshakes, so Origin is never checked on /ws routes
Starlette's CORSMiddleware passes WebSocket scopes straight through, so a WebSocket with Origin: https://evil.example connects even when allow_origins is an explicit list; check websocket.headers['origin'] in the endpoint and close with code 1008 before accept(). Verified with TestClient.websocket_connect on fastapi 0.162.7 / starlette 1.10.0: the evil origin connected, and close(code=1008) before accept() refused it with WebSocketDisconnect code 1008 while the allowed origin still connected. A real uvicorn 0.54.0 run with websockets 17.4 also returned 101 for an evil Origin, so the server does not enforce Origin either. The same app's HTTP route returns no Access-Control-Allow-Origin for that origin, which is easy to mistake for protection on the WebSocket.