chore(memory): BDR-112 db:trial one-factor owner grant, contract and plan
This commit is contained in:
1 parent
45d74536f5
commit
3189a1917d
4 files changed
+113
No files matched your search
@@ -0,0 +1,60 @@
|
||||
# CONTRACT — trial-owner-one-factor
|
||||
- date: 2026-11-11 | flow: feat | branch: feature/v1-2-anatomical-sheets
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
FAUNOSTEO — Modification de la règle MFA
|
||||
|
||||
Je souhaite modifier la décision concernant le nombre de facteurs TOTP.
|
||||
|
||||
Un seul facteur TOTP enrôlé et vérifié doit suffire pour les comptes owner, admin et praticien.
|
||||
|
||||
Un deuxième facteur reste facultatif comme méthode de secours.
|
||||
|
||||
Vérifie où la règle des deux facteurs obligatoires pour owner est appliquée (scripts db:trial, contrats, tests et règles de sécurité).
|
||||
|
||||
Adapte cette règle si elle est spécifique à la pile d'essai, tout en conservant :
|
||||
- L'obligation d'un TOTP vérifié avant l'attribution des rôles privilégiés.
|
||||
- Le niveau AAL2 exigé pour les opérations sensibles.
|
||||
- Les contrôles d'autorisation existants.
|
||||
- L'absence de contournement du MFA.
|
||||
|
||||
Ne modifie pas les règles de production sans étude et autorisation distinctes.
|
||||
|
||||
Teste, fais vérifier et documente le changement avant de reprendre les commandes grant.
|
||||
|
||||
Ne touche ni à DEV ni à la sandbox automatisée. Ne recrée aucun compte et ne réinitialise aucune donnée.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: where is the two-factor owner rule applied? / A: (investigation, main loop) enforced only by scripts/db-trial.sh (`need=2` for owner in grant_platform_role) and pinned by scripts/db-trial-check.sh; the SQL (`private.assign_platform_role`, `private.has_verified_totp`) requires one verified factor on the session path and none on the operator path, never two; the contract docs/development/V1-2_ANATOMICAL_SHEETS.md §5.7.1, §5.7.2, §5.7.7 state "two factors on two devices before the first grant on any stack" as an operator procedure (covers production); docs/development/IDENTITY.md calls it a recommendation; apps/app/e2e/shell/admin.spec.ts A0 and packages/supabase/tests/sandbox/seed-owner-mfa.sandbox.ts enrol two factors as a scenario (they do not require two; sandbox suites, untouched).
|
||||
Q: production rule? / A: unchanged (owner: no production rule change without a distinct study and authorisation): V1-2 §5.7 keeps its text; a dated note scopes the db:trial exception; IDENTITY.md untouched.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. scripts/db-trial.sh grants `owner` with one verified TOTP factor, as `admin`: no factor count of 2 remains in grant_platform_role; the factor count before the typed confirmation and the recount inside the grant transaction (`>= :need`, `\gset` fails on zero rows) both stay, with need = 1.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && f=scripts/db-trial.sh && ! grep -qE 'need=2|\|\| need=' "$f" && grep -q 'local need=1' "$f" && grep -q '>= :need' "$f" && grep -q 'factor_count "\$1"' "$f" && grep -q 'confirm "grant \$2"' "$f" && echo ONE_FACTOR_OK
|
||||
EXPECT: ONE_FACTOR_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: ONE_FACTOR_OK
|
||||
2. The harness pins it: owner with 0 verified factors refused ("owner needs 1", nothing granted, no role SQL); owner with 1 factor granted with `-v need=1`; owner with 2 factors still granted (optional backup); the in-transaction recount falling to 0 refuses, nothing granted; admin and catalogue-right cases unchanged; the whole harness passes.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -q 'owner needs 1' scripts/db-trial-check.sh && grep -q -- '-v role=owner -v need=1' scripts/db-trial-check.sh && ! grep -q 'need=2' 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-mfa.txt 2>&1 ; tail -n 1 /tmp/claude-1000/-home-bchanot-Documents-faunosteo/463d8810-0112-4b67-92e4-aa3c30af6089/scratchpad/gate-harness-mfa.txt
|
||||
EXPECT: db-trial-check: ALL PASS
|
||||
EVIDENCE: MET exit=0 marker-found :: db-trial-check: ALL PASS
|
||||
3. Kept unchanged: every SQL file, the catalogue-right checks (`private.has_verified_totp` before sheet_editor / reviewer / publisher), aal2 in the app and RPCs, the operator-path audit row; no MFA bypass added.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only HEAD -- supabase apps packages crates scripts/db-sandbox.sh)" ] && [ "$(git diff -U0 HEAD -- scripts/db-trial.sh | grep -cE '^[-+].*(has_verified_totp|is_platform_admin|log_event|assign_platform_role)')" -eq 0 ] && echo KEPT_OK
|
||||
EXPECT: KEPT_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: KEPT_OK
|
||||
4. bash -n and shellcheck clean, 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 HEAD -- scripts | grep -c '^+.*shellcheck disable')" -eq 0 ] && echo LINT_OK
|
||||
EXPECT: LINT_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: LINT_OK
|
||||
5. Docs: SUPABASE.md §5.2 (grant row, first-use step 1) and the script's `account` hint say one verified factor for owner and admin, a second optional as backup; V1-2_ANATOMICAL_SHEETS.md carries a dated note (owner 2026-11-11) that the db:trial stack takes one factor for the owner grant while the rule for every other stack (production included) is unchanged pending a distinct study and authorisation; IDENTITY.md unchanged.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && ! grep -q 'two for owner' docs/development/SUPABASE.md && ! grep -q 'enrol two TOTP' docs/development/SUPABASE.md && grep -q '2026-11-11' docs/development/V1-2_ANATOMICAL_SHEETS.md && [ -z "$(git diff --name-only HEAD -- docs/development/IDENTITY.md)" ] && ! grep -q 'two factors for the owner account' scripts/db-trial.sh && echo DOCS_OK
|
||||
EXPECT: DOCS_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: DOCS_OK
|
||||
6. Scope: only scripts/db-trial.sh, scripts/db-trial-check.sh, docs/development/SUPABASE.md, docs/development/V1-2_ANATOMICAL_SHEETS.md change; 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|docs/development/V1-2_ANATOMICAL_SHEETS\.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
|
||||
7. No secret, no DEV or sandbox action, no account or data change (harness = fake Docker only).
|
||||
|
||||
## FILE SCOPE
|
||||
scripts/db-trial.sh (grant_platform_role ~1719-1747, its comment ~1696-1700, the account hint ~1693), scripts/db-trial-check.sh (grant cases ~1211-1242 and ~1312-1323), docs/development/SUPABASE.md (§5.2 grant row ~867, first-use ~874), docs/development/V1-2_ANATOMICAL_SHEETS.md (§5.7.1 step 2 dated note, §5.6 pointer)
|
||||
Reference in new issue
Block a user