Перевести пароли на Argon2id и читать секреты через AppRole.

Лимит входа общий для реплик, размер тела ограничен, исходящие клиенты проверяют TLS, если задан CA.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-26 19:40:28 +03:00
co-authored by Cursor
parent 54b4b9e509
commit fb566d874c
19 changed files with 445 additions and 20 deletions
+12 -3
View File
@@ -20,11 +20,18 @@ BEARER_CHALLENGE = 'Bearer realm="messenger"'
class AppError(Exception):
def __init__(self, status: int, message: str, www_authenticate: str | None = None) -> None:
def __init__(
self,
status: int,
message: str,
www_authenticate: str | None = None,
headers: Optional[Dict[str, str]] = None,
) -> None:
super().__init__(message)
self.status = status
self.message = message
self.www_authenticate = www_authenticate
self.headers = headers or {}
def error_response(
@@ -45,5 +52,7 @@ def error_response(
def from_app_error(exc: AppError, request_id: str) -> JSONResponse:
extra = {"WWW-Authenticate": exc.www_authenticate} if exc.www_authenticate else None
return error_response(exc.status, exc.message, request_id, extra)
extra: Dict[str, str] = dict(exc.headers)
if exc.www_authenticate:
extra["WWW-Authenticate"] = exc.www_authenticate
return error_response(exc.status, exc.message, request_id, extra or None)