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:
@@ -14,12 +14,22 @@ lifetime, then run pytest inside the running `backend` container — it's the
|
||||
only place with network access to Postgres:
|
||||
|
||||
```bash
|
||||
docker compose exec backend pip install -r requirements-dev.txt
|
||||
docker compose exec backend pytest -v
|
||||
docker compose exec backend pip install --user -r requirements-dev.txt
|
||||
docker compose exec backend python -m pytest -v
|
||||
```
|
||||
|
||||
Re-run just `pytest -v` for subsequent runs; the `pip install` only needs
|
||||
repeating after a container restart/rebuild.
|
||||
Re-run just the `python -m pytest -v` line for subsequent runs; the
|
||||
`pip install` only needs repeating after a container restart/rebuild.
|
||||
|
||||
Two details that both come from the container running as an unprivileged user
|
||||
(`aurum`, uid 10001 — see backend/Dockerfile) rather than root:
|
||||
|
||||
- `--user` on the install: site-packages belongs to root and isn't writable.
|
||||
The packages land in `/home/aurum/.local`, which isn't on `PATH`, hence
|
||||
`python -m pytest` instead of a bare `pytest`.
|
||||
- pytest prints a `PytestCacheWarning` about not being able to write
|
||||
`/app/.pytest_cache`. Expected — the source tree is read-only to the app
|
||||
user by design. Tests still pass; add `-p no:cacheprovider` to silence it.
|
||||
|
||||
## Adding a test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user