Tests for auth refresh, ad viewability and URL safety; nginx, Dockerfile, README

- Jest: single-flight refresh, session expiry vs transient errors, token save on login change,
  logout revoke, IAB viewability, safe URLs, HTML escaping, password policy, ad session id
- test:ci with explicit testMatch (dot-directories in worktree paths hid all tests)
- nginx: gzip, nosniff/Referrer-Policy/X-Frame-Options, no-cache for index.html
- Dockerfile: npm ci, REACT_APP_WS_ERROR_QUEUE build arg
- README: new backend contracts, flags, compatibility notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-20 11:56:39 +03:00
parent 804018d2ce
commit a029254cf0
10 changed files with 485 additions and 26 deletions

View File

@@ -3,12 +3,36 @@ server {
root /usr/share/nginx/html;
index index.html;
# Сжатие JS/CSS/JSON/SVG: бандл CRA без него весит в 3–4 раза больше
gzip on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_types text/css application/javascript application/json image/svg+xml text/plain;
# Базовые заголовки безопасности. CSP не задаём: Яндекс.Карты, MinIO и
# домен API нужно сначала перечислить (см. README, «Безопасность»).
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "DENY" always;
# Хешированные файлы CRA — навсегда в кэш
location /static/ {
expires 1y;
add_header Cache-Control "public, immutable";
# add_header в location отменяет заголовки уровня server — повторяем
add_header X-Content-Type-Options "nosniff" always;
}
# index.html не кэшируем: иначе после деплоя браузер держит старую
# страницу со ссылками на удалённые бандлы (белый экран)
location = /index.html {
add_header Cache-Control "no-cache";
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "DENY" always;
}
location / {
try_files $uri /index.html;
}
}
}