Files
faunosteo/.claude/tasks/contracts/2026-10-21-rust-r4-premerge-1830.md
T

8.8 KiB
Raw Blame History

Contract: R4.12 pre-merge fixes D1 / D3 / D6

Base: ff122d1 on feature/rust-r4-pdf-core (« chore(memory): Context7 documentation review report, TODO R4.11 checkpoint »). Range: ff122d1..HEAD; <base> below is ff122d1. Date: 2026-10-21.

REQUEST (verbatim, owner, « Validation R4.11 et derniers ajustements avant recette Safari »)

« D1 — Distroless Debian 13 : autorisé maintenant. Migrer l'image de base du worker de static-debian12 vers la variante Debian 13 officiellement maintenue. Vérifier la provenance et la compatibilité de l'image avant modification. Conserver l'exécution non-root, les protections sandbox, les contraintes de ressources et le comportement HTTPS. Valider avec worker:test, worker:image, les tests de sandbox et les vérifications pertinentes du worker réel. Ne pas modifier l'architecture ni assouplir les restrictions de sécurité. »

« D3 — safeNextPath : correction obligatoire maintenant. Corriger la faille logique permettant à une valeur telle que /..//evil.com d'aboutir à //evil.com. La fonction doit garantir que sa valeur retournée est un chemin interne sûr, y compris après normalisation. Ajouter des tests ciblant les segments de parcours, les doubles slashs, antislashs, schémas externes, encodages pertinents et destinations déjà valides. Ne pas casser les redirections internes légitimes. Vérifier les consommateurs et le comportement réel de React Router sans supposer que sa protection actuelle dispense de sécuriser notre propre contrat. »

« D6 — DEPLOY.md : correction autorisée maintenant. Mettre à jour la syntaxe Nginx obsolète vers http2 on; dans le runbook. Préserver les autres directives et le comportement documenté. Ne modifier aucun serveur de production. »

« D2 […] ne réalise pas maintenant un remplacement global des 13 fichiers. […] D4 — Ménages de configuration : différés. […] D5 — MotionConfig […] Ne l'implémente pas dans ce dernier lot R4. »

« Séparer clairement les commits des corrections D1, D3 et D6. Exécuter pnpm check:all sur l'état final, les audits de sécurité, les tests du worker et les tests ciblés de navigation. Conserver les oracles et goldens PDF inchangés. Faire vérifier indépendamment les corrections réalisées. Signaler toute régression ou incompatibilité réelle plutôt que d'ajouter une exception. Ne pas modifier le comportement du moteur PDF en l'absence de défaut démontré. […] Après les trois corrections ciblées et leurs vérifications, arrête-toi au checkpoint de pré-fusion. »

FILE SCOPE

  • D3: apps/app/src/auth/redirects.ts, apps/app/tests/unit/auth.validation.test.ts, apps/app/tests/unit/routes.LoginRoute.test.tsx
  • D1: crates/worker/Dockerfile (the runtime FROM line and its comment)
  • D6: DEPLOY.md (the host nginx listen 443 lines of Option A)
  • Docs: docs/development/RUST.md §10.14 (new), CHANGELOG.md (Unreleased, Fixed 2026-10-21)
  • .claude/tasks/contracts/2026-10-21-rust-r4-premerge-1830.md (this contract), .claude/tasks/TODO.md, .claude/memory/{journal,learnings,decisions}.md

Out of scope: every other file, in particular the 13 files of D2 (outline-none stays), MotionConfig, the D4 files (apps/app/vitest.config.ts, apps/app/tests/setup.ts, apps/app/eslint.config.js, ui/{Input,Select,Textarea}.tsx, state/authStore.ts), crates/**/src, crates/core/tests, apps/app/tests/fixtures, packages/**, package manifests and lockfiles; any deletion.

ACCEPTANCE CRITERIA

  1. Three code/doc commits, one per decision: git log --oneline <base>..HEAD -- apps/app/src/auth/redirects.ts = one commit (D3); -- crates/worker/Dockerfile = one other commit (D1); -- DEPLOY.md = one third commit (D6); none of the three commits touches another decision's files (git show --stat <sha>).
  2. D3 contract: for every input in ['/..//evil.test','/.//evil.test','/a/..//evil.test','/a/b/../..//evil.test','/..\\\\evil.test','/x/..\\/evil.test','/%2e%2e//evil.test','/%2E%2E//evil.test','/.%2e//evil.test','/a/%2e%2e//evil.test','/.\t.//evil.test','///evil.test','//evil.test','/\\evil.test','https://evil.test/','javascript:alert(1)',''] the returned value does not start with // and resolves to the same origin as a probe origin (check by a node one-liner importing the compiled logic, or read through the test file's cases); legitimate paths unchanged: /app/account?tab=x#s, /editor, /app//account, /%2F%2Fevil.test (literal), /app/account?next=//evil.test; /app/../app/account → /app/account.
  3. D3 tests: apps/app/tests/unit/auth.validation.test.ts has the four new safeNextPath cases (dot segments, schemes and escapes, encoded and legitimate paths, idempotence) and routes.LoginRoute.test.tsx the next=/..//evil.test/app/account → dashboard case; they pass (cd apps/app && ./node_modules/.bin/vitest run tests/unit/auth.validation.test.ts tests/unit/routes.LoginRoute.test.tsx tests/unit/guards.RequireAuth.test.tsx); at least the dot-segment case and the LoginRoute case fail on the pre-fix function (git show <base>:apps/app/src/auth/redirects.ts), proven by the orchestrator's run: « × safeNextPath > refuses dot segments that normalise into a protocol-relative path », « × safeNextPath > keeps encoded slashes literal and legitimate internal paths unchanged », « × LoginRoute > lands on the dashboard when next normalises into another host (R4.12) », « Tests 3 failed | 16 passed (19) »; the verifier checks by reading that the old function returns //evil.test for /..//evil.test (node one-liner on new URL('/..//evil.test','http://next.invalid').pathname).
  4. D1: crates/worker/Dockerfile runtime stage is FROM gcr.io/distroless/static-debian13:nonroot AS runtime, still followed by COPY --from=build /faunosteo-worker /faunosteo-worker, USER nonroot, ENTRYPOINT ["/faunosteo-worker"], CMD ["run", "--check"]; the build and test stages unchanged (git diff <base> -- crates/worker/Dockerfile touches only the runtime FROM and two comment lines); docker image inspect faunosteo_worker:dev shows user nonroot, entrypoint /faunosteo-worker, cmd run --check; docker run --rm --network none --entrypoint /bin/sh faunosteo_worker:dev -c true fails (no shell).
  5. D1 proofs in the check:all log (<session scratchpad>/checkall-r412.log, path in the verifier's brief): gcr.io/distroless/static-debian13:nonroot@sha256:d62067879de890a1def9da0e7766b7d20810a5e5555cef8506b752437d7a3e88 resolved for the runtime, the worker test stage test result: ok lines including tests/tls.rs, the seccomp derivation, the runtime run --check output; and pnpm e2e:avatar 5/5 on this image (<session scratchpad>/e2e-d1.log). Read the logs, do not re-run Docker builds or the stack.
  6. D6: DEPLOY.md Option A server block reads listen 443 ssl;, listen [::]:443 ssl;, http2 on; with a comment naming nginx >= 1.25.1, the 1.24 form (listen 443 ssl http2;) and nginx -v; no other DEPLOY.md line changed (git diff <base> -- DEPLOY.md: 6 insertions, 2 deletions); the incompatibility (nginx 1.24 rejects http2 on) recorded in RUST.md §10.14.
  7. Scope held: git diff --stat <base> -- apps/app/src lists auth/redirects.ts only; no outline-none, MotionConfig, vitest/jest-dom/eslint/forwardRef/authStore change; git diff --stat <base> -- crates/core crates/wasm crates/worker/src apps/app/tests/fixtures crates/core/tests packages Cargo.lock pnpm-lock.yaml empty; no deletion (git diff --diff-filter=D --name-only <base> empty).
  8. Suites: pnpm check:all exit 0 on the final code state (log <session scratchpad>/checkall-r412.log ending == all checks passed, apps/app 59 files / 434 cases); pnpm audit --prod clean; cargo deny check ok; pnpm typecheck, pnpm lint exit 0; git status --short empty.
  9. Docs: RUST.md §10.14 covers D3 (cases, consumers, react-router behaviour read in the installed package, negative run), D1 (provenance and digest, cosign not checked, contents, proofs, e2e), D6 (the 1.24 incompatibility and the nginx -t runs); CHANGELOG Unreleased has the line; TODO carries the accessibility chantier (D2, D5) and the maintenance backlog (D4) without doing them.

CLARIFICATIONS

Q: D6 says « vers http2 on; »; the live VPS runs nginx 1.24, which rejects it. Replace blindly? / A: no: the owner asked to report a real incompatibility rather than work around it silently; the runbook gives the new form for >= 1.25.1 and names the 1.24 form, both proven with nginx -t. [gated 2026-10-21, owner « Signaler toute régression ou incompatibilité réelle »] Q: the worker's real check without the managed Supabase? / A: pnpm e2e:avatar on the local stack (the documented real-stack test, plain HTTP on the Docker network); the HTTPS path is the R4.11 TLS test, unchanged and run in the image's test stage. [gated 2026-10-21, owner D1 « vérifications pertinentes du worker réel »]