MCPcopy Create free account
hub / github.com/Trex099/Velocity-Bridge / validate_token

Function validate_token

Velocity_GUI/src-python/server.py:186–195  ·  view source on GitHub ↗

Validate the security token. Raises 403 if invalid.

(token: str, request: Request = None)

Source from the content-addressed store, hash-verified

184
185
186def validate_token(token: str, request: Request = None) -> None:
187 """Validate the security token. Raises 403 if invalid."""
188 # Only validate if a token is actually enforced on the server (AUTH FIX)
189 if SECURITY_TOKEN and token != SECURITY_TOKEN:
190 # Log failed attempt with client IP
191 client_ip = "unknown"
192 if request:
193 client_ip = request.client.host if request.client else "unknown"
194 logger.warning(f"Authentication failed from IP: {client_ip}")
195 raise HTTPException(status_code=403, detail="Invalid security token")
196
197
198def detect_display_server() -> Literal["wayland", "x11", "unknown"]:

Callers 9

shutdownFunction · 0.70
regenerate_tokenFunction · 0.70
get_clipboardFunction · 0.70
upload_imageFunction · 0.70
upload_imagesFunction · 0.70
receive_clipboardFunction · 0.70
upload_fileFunction · 0.70
get_historyFunction · 0.70
clear_historyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected