mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
Конфигурация и эксплуатационный слой: - 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.
78 lines
2.5 KiB
YAML
78 lines
2.5 KiB
YAML
name: CI
|
|
|
|
# Runs on every pull request and on pushes to main, so a broken PR shows a
|
|
# red check before it's mergeable (enable "Require status checks to pass"
|
|
# in branch protection for main to actually block the merge button on it).
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
# Least privilege for GITHUB_TOKEN: these jobs only ever read the checkout.
|
|
# Without this the token inherits the repository default, which can include
|
|
# write access — handed to every third-party action in the run.
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
backend-tests:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
# A real Postgres, not sqlite — tests/conftest.py creates/migrates/
|
|
# drops a dedicated aurum_test database against it, same as the local
|
|
# `docker compose exec backend pytest` workflow in tests/README.md.
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: aurum
|
|
POSTGRES_PASSWORD: aurum
|
|
POSTGRES_DB: aurum
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U aurum"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
AURUM_POSTGRES_USER: aurum
|
|
AURUM_POSTGRES_PASSWORD: aurum
|
|
AURUM_POSTGRES_DB: aurum
|
|
AURUM_POSTGRES_HOST: localhost
|
|
AURUM_POSTGRES_PORT: 5432
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
cache-dependency-path: backend/requirements-dev.txt
|
|
- run: pip install -r requirements-dev.txt
|
|
- run: pytest -v
|
|
|
|
frontend-build:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
- run: npm ci
|
|
# tsc -b (type-check) then vite build — catches both a broken build
|
|
# and a type error a PR might introduce, same as `npm run build`
|
|
# locally before shipping a change.
|
|
- run: npm run build
|
|
# Vitest over the pure-logic modules (lib/format.ts, the Crypto tab's
|
|
# allocation math) — kept in the same job rather than a new one so a
|
|
# renamed job doesn't silently stop matching branch protection's
|
|
# required status checks.
|
|
- run: npm run test
|