Перевести пароли на 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
+22
View File
@@ -0,0 +1,22 @@
import ssl
from app import config
def server_context() -> ssl.SSLContext | None:
"""Trust store for outbound TLS. None means the dependency is still plaintext."""
if not config.TLS_CA_FILE:
return None
context = ssl.create_default_context(cafile=config.TLS_CA_FILE)
context.check_hostname = True
context.verify_mode = ssl.CERT_REQUIRED
context.minimum_version = ssl.TLSVersion.TLSv1_2
if config.TLS_CERT_FILE and config.TLS_KEY_FILE:
context.load_cert_chain(config.TLS_CERT_FILE, config.TLS_KEY_FILE)
return context
def https_verify(endpoint: str):
if endpoint.startswith("https://") and config.TLS_CA_FILE:
return config.TLS_CA_FILE
return True