mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
security: устранить находки аудита, версия 1.1.7
Конфигурация и эксплуатационный слой: - nginx: client_max_body_size 64m — восстановление из бэкапа не работало вовсе, дефолтный лимит в 1 МБ резал дампы (реальный экспорт ~3.4 МБ) с 413 ещё до backend; - nginx: заголовки безопасности (nosniff, Referrer-Policy, Permissions-Policy) и полный Content-Security-Policy. Ради него inline-скрипт темы вынесен в public/theme-init.js; - nginx: limit_req на /api/ — перебор пароля Basic Auth шёл со скоростью сети, ни блокировки, ни задержки не было; - nginx: server_tokens off; - порт web привязан к 127.0.0.1, адрес настраивается через AURUM_BIND_ADDRESS (раньше слушался на всех интерфейсах); - backend работает от непривилегированного пользователя, no-new-privileges для backend и web; - дефолты пароля Postgres сведены к одному значению в обоих сервисах, в .env.example описана ловушка с инициализацией тома. Приложение: - версия убрана из неавторизованного /api/health и отдаётся как app_version в GET /api/settings; - /api/docs, /api/redoc и /api/openapi.json отключаются через AURUM_ENABLE_DOCS; - текст исключения при неудачном восстановлении уходит в лог, а не клиенту; - max_length для notes в схемах транзакций, активов и регулярных платежей (и в соответствующих полях UI); - срок «запомнить меня» сокращён с 30 дней до 7; - pytest обновлён до 9.0.3 (PYSEC-2026-1845), pytest-asyncio до 1.4.0; - CI: permissions contents:read для GITHUB_TOKEN.
This commit is contained in:
@@ -4,10 +4,11 @@ from functools import lru_cache
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
# Single source of truth for the running app's version — surfaced in the API
|
||||
# title, /api/health (which the frontend reads to show it in Settings), and
|
||||
# embedded in exported backups so an old file can be told apart from a
|
||||
# current one.
|
||||
APP_VERSION = "1.1.6"
|
||||
# title, in GET /api/settings as app_version (which the frontend reads to show
|
||||
# it in Settings; it deliberately does NOT ride on the unauthenticated
|
||||
# /api/health), and embedded in exported backups so an old file can be told
|
||||
# apart from a current one.
|
||||
APP_VERSION = "1.1.7"
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
@@ -35,6 +36,14 @@ class Settings(BaseSettings):
|
||||
# rather than silently hitting CoinGecko's much stingier keyless tier.
|
||||
coingecko_api_key: str = ""
|
||||
|
||||
# Swagger/ReDoc/openapi.json at /api/docs. On by default because the API
|
||||
# is a documented feature of this app (see DOCS.md), and because when
|
||||
# basic auth is configured these sit behind it like everything else under
|
||||
# /api/. Turn it off on an instance that's reachable from the internet
|
||||
# *without* basic auth: an open /api/openapi.json is a complete,
|
||||
# machine-readable map of every endpoint and payload shape.
|
||||
enable_docs: bool = True
|
||||
|
||||
@property
|
||||
def database_url(self) -> str:
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user