5.5 KiB
CONTRACT — trial-init-log-leak
- date: 2026-11-11 | flow: bugfix | branch: feature/v1-2-anatomical-sheets
- status: active
REQUEST (verbatim — IMMUTABLE)
FAUNOSTEO — Correction minimale de la fuite TR_PW (owner, 2026-11-11), part 3 and the scope lines that bind it:
- Empêcher que la fuite se reproduise
Corriger uniquement la cause identifiée.
Le script d'initialisation de l'image PostgreSQL écrit une instruction ALTER USER contenant le mot de passe pendant que log_statement est actif.
Configurer PostgreSQL pour désactiver la journalisation des instructions dès le premier démarrage, avant l'exécution des scripts d'initialisation.
Vérifier que la configuration est bien transmise au serveur temporaire d'initialisation utilisé par l'image.
Ajouter un test ciblé et consigner ce risque comme point obligatoire de vérification pour toute future installation de production.
Pas de refonte de l'infrastructure ni de campagne générale de durcissement.
- Périmètre
Ne pas toucher maintenant aux autres sujets : Playwright LAN, destroy, révocation des sessions, durcissement général ou nettoyage des fichiers temporaires.
Ne pas créer de comptes, importer d'assets, fusionner de branche ni déployer.
Commits et push autorisés sur la branche de travail après vérification.
Enregistrer simplement la cause, le correctif et la vérification à prévoir avant production.
CLARIFICATIONS
Q: where is the mandatory pre-production check recorded? / A: delegated — DEPLOY.md "Security prerequisites before deploying anything built from develop" (the production gate list), plus the trial's own record in docs/development/SUPABASE.md §5.2.
Q: also close adjacent paths (log_min_error_statement at init, migrate.sh's password in psql argv, db-sandbox.sh's identical DB_INIT)? / A: no — owner: "Corriger uniquement la cause identifiée", sandbox untouched; they are named as residual risks in the docs, not fixed.
ACCEPTANCE CRITERIA
- The database container's command line hands
-c log_statement=noneto the image entrypoint afterpostgres, so thatdocker_temp_server_start "$@"passes it to the init temp server (and the final server): theexec docker-entrypoint.sh postgresline of DB_INIT in scripts/db-trial.sh carries it. CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -E "exec docker-entrypoint.sh postgres( [^ ]+)* -c log_statement=none( |$)" scripts/db-trial.sh | grep -q . && echo INIT_FLAG_OK EXPECT: INIT_FLAG_OK EVIDENCE: MET exit=0 marker-found :: INIT_FLAG_OK - The fake-Docker harness carries a targeted check on the db container's
docker runline asserting that flag on the entrypoint'spostgresline (the first line of thesh -cscript), and the whole harness passes. CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -q "log_statement=none" scripts/db-trial-check.sh && bash scripts/db-trial-check.sh </dev/null > /tmp/claude-1000/-home-bchanot-Documents-faunosteo/463d8810-0112-4b67-92e4-aa3c30af6089/scratchpad/gate-harness.txt 2>&1 && tail -n 1 /tmp/claude-1000/-home-bchanot-Documents-faunosteo/463d8810-0112-4b67-92e4-aa3c30af6089/scratchpad/gate-harness.txt EXPECT: db-trial-check: ALL PASS EVIDENCE: MET exit=0 marker-found :: db-trial-check: ALL PASS - Positive control: with the flag removed from DB_INIT (temporarily, on the working copy, then restored), the new check FAILS by name; the executor reports that red run (check name and FAIL line) and the restoration.
- bash -n and shellcheck stay clean on both scripts (no new directive). CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && bash -n scripts/db-trial.sh && bash -n scripts/db-trial-check.sh && shellcheck -x scripts/db-trial.sh scripts/db-trial-check.sh && [ "$(git diff -U0 -- scripts | grep -c '^+.*shellcheck disable')" -eq 0 ] && echo LINT_OK EXPECT: LINT_OK EVIDENCE: MET exit=0 marker-found :: LINT_OK
- The docs record the cause (the image's migrate.sh sends the password as SQL text on the init temp server while postgresql.conf sets log_statement = 'ddl'), the fix (
-c log_statement=noneon the server command line, passed to the init temp server by the entrypoint), and a mandatory pre-production verification (statement logging off from the first start, and the container log scanned for the password after init) for any self-hosted production database on this image; DEPLOY.md's security prerequisites list carries the verification. CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -q "log_statement=none" DEPLOY.md && grep -q "log_statement=none" docs/development/SUPABASE.md && echo DOCS_OK EXPECT: DOCS_OK EVIDENCE: MET exit=0 marker-found :: DOCS_OK - Scope: only scripts/db-trial.sh, scripts/db-trial-check.sh, docs/development/SUPABASE.md and DEPLOY.md change; db-sandbox.sh, migrations, seed, crates and apps untouched; the untracked ChatGPT review file kept. CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only HEAD | grep -vxE 'scripts/db-trial.sh|scripts/db-trial-check.sh|docs/development/SUPABASE.md|DEPLOY.md|.claude/tasks/.*')" ] && [ -f faunosteo-v1-2-6-revue-ux-chatgpt.md ] && echo SCOPE_OK EXPECT: SCOPE_OK EVIDENCE: MET exit=0 marker-found :: SCOPE_OK
- No secret value, no new network exposure, no change to any other DB_INIT line or container option.
FILE SCOPE
scripts/db-trial.sh (DB_INIT exec line and the comment above DB_INIT), scripts/db-trial-check.sh (one targeted check next to the existing init logging checks, ~line 725), docs/development/SUPABASE.md (§5.2 trial paragraph on the init), DEPLOY.md (security prerequisites list)