feat(security): add CSRF header constants and security-headers endpoint
Move X-BanGUI-Request header name/value to backend/app/utils/constants.py as single source of truth. Add GET /api/v1/config/security-headers endpoint. Update csrf middleware, frontend api client, and docs to use shared constants.
This commit is contained in:
@@ -45,6 +45,12 @@ SESSION_TOKEN_SIGNATURE_SEPARATOR: Final[str] = "."
|
||||
SESSION_COOKIE_NAME: Final[str] = "bangui_session"
|
||||
"""Name of the session cookie used by the browser SPA."""
|
||||
|
||||
CSRF_HEADER_NAME: Final[str] = "X-BanGUI-Request"
|
||||
"""Name of the custom header clients must send for state-mutating requests."""
|
||||
|
||||
CSRF_HEADER_VALUE: Final[str] = "1"
|
||||
"""Required value of the CSRF header to pass validation."""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Authentication penalty (brute-force resistance)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user