fix: only register debug endpoint when DEBUG=True

The /debug/cors endpoint is now conditionally registered, preventing
information leakage about CORS configuration in production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-06 00:24:02 -05:00
parent 5ae22e041f
commit 94ec19cf07

View File

@@ -89,8 +89,9 @@ async def health_check():
return {"status": "healthy"} return {"status": "healthy"}
@app.get("/debug/cors") if settings.DEBUG:
async def debug_cors(): @app.get("/debug/cors")
async def debug_cors():
"""Debug endpoint to check CORS configuration.""" """Debug endpoint to check CORS configuration."""
return { return {
"allow_railway_origins": settings.ALLOW_RAILWAY_ORIGINS, "allow_railway_origins": settings.ALLOW_RAILWAY_ORIGINS,