Skip to content

TranscrIA 0.3.9.1 — Security hardening & first-boot fix / Durcissement sécurité & correctif de premier démarrage

Choose a tag to compare

@Martossien Martossien released this 21 Jul 19:44
· 302 commits to main since this release

Security hardening & first-boot fix

Patch release. All hardening is opt-in (default unchanged) — no database migration, no new dependency.

Added — all opt-in, from Administration → Configuration → "HTTP(S) hardening" (or security.*):

  • HTTP(S): behind_tls_proxy (the app learns it is served over HTTPS via X-Forwarded-Proto — the client IP is never read from X-Forwarded-For, so anti-brute-force stays sound), session_cookie_secure, hsts_enabled / hsts_max_age_days (HSTS emitted only on a real HTTPS response).
  • CSRF: csrf_origin_check (rejects cross-origin cookie POSTs, on top of SameSite) and csrf_tokens (synchronizer token on every state-changing request, auto-injected into forms and UI calls; the Bearer-token API stays exempt).
  • Content-Security-Policy (security.csp: off | report-only | enforce): strict script-src ('self' + per-request nonce, no 'unsafe-inline'), made possible by migrating every inline event handler to a delegated dispatcher; locks down frames, objects, base and forms. Browser-validated (Playwright): enforcezero CSP violations, interactions work. Deploy report-only first, then enforce.
  • doctor: an "HTTP(S) transport" check (warns if a federated auth backend runs without a secure cookie or TLS proxy).

Fixed:

  • Concurrent first boot: on the very first boot against an empty database, multiple gunicorn workers could create the admin in parallel → unique-constraint violation → the service refused to start (a restart then worked). ensure_admin is now idempotent.

See docs/SECURITY_MODEL.md (§§ 2, 3, 7) and docs/UPGRADE.md § "Durcissement de sécurité (0.3.9.1)".


Durcissement de sécurité & correctif de premier démarrage

Version corrective. Tous les durcissements sont opt-in (défaut inchangé) — aucune migration de base, aucune nouvelle dépendance.

Ajouté — tout opt-in, depuis Administration → Configuration → « Durcissement HTTP(S) » (ou clés security.*) :

  • HTTP(S) : behind_tls_proxy (l'app reconnaît le HTTPS via X-Forwarded-Proto — l'IP cliente n'est jamais lue depuis X-Forwarded-For, l'anti-bourrinage reste sain), session_cookie_secure, hsts_enabled / hsts_max_age_days (HSTS uniquement sur une réponse HTTPS réelle).
  • CSRF : csrf_origin_check (refuse les POST cookie d'origine croisée, en plus de SameSite) et csrf_tokens (jeton synchroniseur à chaque requête mutante, injecté automatiquement dans les formulaires et les appels de l'interface ; l'API par jeton Bearer reste exemptée).
  • Content-Security-Policy (security.csp : off | report-only | enforce) : script-src STRICT ('self' + nonce par requête, sans 'unsafe-inline'), rendu possible par la migration de tous les gestionnaires d'événements inline vers une délégation. Validé au navigateur (Playwright) : enforcezéro violation CSP, interactions fonctionnelles. Déployer d'abord en report-only, puis enforce.
  • doctor : contrôle « Transport HTTP(S) » (avertit si un backend d'auth fédéré tourne sans cookie sécurisé ni proxy TLS).

Corrigé :

  • Premier démarrage concurrent : au tout premier boot sur une base vierge, plusieurs workers gunicorn pouvaient créer l'admin en parallèle → violation d'unicité → le service refusait de démarrer. ensure_admin est désormais idempotent.

Guides : docs/SECURITY_MODEL.md (§§ 2, 3, 7) et docs/UPGRADE.md § « Durcissement de sécurité (0.3.9.1) ».


Docker : ghcr.io/martossien/transcria-allinone:v0.3.9.1 (slim) et :v0.3.9.1-bundled (tout embarqué) — publiques.