• Stefy Lanza (nextime / spora )'s avatar
    api: enforce API tokens under a bare uvicorn start · f4482fd5
    Stefy Lanza (nextime / spora ) authored
    Found while checking the production proxy path. BearerAuthMiddleware falls
    OPEN when admin.routes.session_manager is None and no CODERAI_API_TOKEN is
    set: with no user database to check a token against it lets the request
    through rather than locking out an install with no auth configured. That is
    defensible on a loopback workstation.
    
    main.py and build_system_app() both initialise that database. A bare
    `uvicorn codai.api.app:app` start — exactly how the GPU-less orchestrator
    runs — did not, so once published through a reverse proxy every /v1/* call
    was served WITHOUT credentials. Verified before and after: session_manager
    None on import, /v1/models 200 with no header; now initialised at import
    and 401 for no header, a wrong Bearer, and nginx's Basic.
    
    The readiness probes stay open on purpose (/healthz, /health, /v1/health):
    a probe behind auth is read as "backend down" by every health checker,
    surya-ocr's vLLM client included.
    
    The guide gains the three traps of that deployment: auth_basic and Bearer
    share one header so the API path must not be basic-authed, proxy_buffering
    must be off for streaming, and how to check in one curl whether tokens are
    actually enforced.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    f4482fd5
Name
Last commit
Last update
..
superpowers Loading commit data...
README.md Loading commit data...
cluster.md Loading commit data...
deepseek-ds4.md Loading commit data...
dtype-auto-selection.md Loading commit data...
expressive-tts.md Loading commit data...
frontend-engine-split.md Loading commit data...
gguf-process-isolation.md Loading commit data...
glm-colibri.md Loading commit data...
install-from-packages.md Loading commit data...
kimi-k3.md Loading commit data...
ktransformers.md Loading commit data...
longcat-video.md Loading commit data...
minimax-h3.md Loading commit data...
ocr.md Loading commit data...
orchestrator-runpod-guide.md Loading commit data...
process-isolation-plans.md Loading commit data...
reference-projects.md Loading commit data...
remote-execution.md Loading commit data...
reverse-proxy-nginx.md Loading commit data...
runpod.md Loading commit data...
tools-as-services.md Loading commit data...
video-compose.md Loading commit data...
vllm.md Loading commit data...
zimage-lora-training.md Loading commit data...