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:
@@ -89,12 +89,13 @@ 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")
|
||||||
"""Debug endpoint to check CORS configuration."""
|
async def debug_cors():
|
||||||
return {
|
"""Debug endpoint to check CORS configuration."""
|
||||||
"allow_railway_origins": settings.ALLOW_RAILWAY_ORIGINS,
|
return {
|
||||||
"cors_mode": "regex + list" if settings.ALLOW_RAILWAY_ORIGINS else "list",
|
"allow_railway_origins": settings.ALLOW_RAILWAY_ORIGINS,
|
||||||
"allowed_origins": settings.allowed_origins,
|
"cors_mode": "regex + list" if settings.ALLOW_RAILWAY_ORIGINS else "list",
|
||||||
"railway_regex": r"https://.*\.up\.railway\.app" if settings.ALLOW_RAILWAY_ORIGINS else None
|
"allowed_origins": settings.allowed_origins,
|
||||||
}
|
"railway_regex": r"https://.*\.up\.railway\.app" if settings.ALLOW_RAILWAY_ORIGINS else None
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user