fix backend audit findings (auth, upload, sync, data, ocr, contract)
CI / lint-backend (push) Failing after 1m39s
CI / lint-mobile (push) Canceled after 11m8s
CI / test-backend (push) Canceled after 0s
CI / test-mobile (push) Canceled after 0s
CI / build-backend (push) Canceled after 0s
CI / docker (push) Canceled after 0s

This commit is contained in:
m
2026-09-21 19:59:52 +02:00
parent df7dc76405
commit a6b7f2002b
60 changed files with 3414 additions and 412 deletions
+27
View File
@@ -215,6 +215,33 @@ func TestMigrationsUpDown(t *testing.T) {
t.Error("FK resources.user_id → users(id) manquante après 000007")
}
// --- 000007 : migration douce (#10) ----------------------------------
// user_id NULLABLE (orphelines conservées, pas de DELETE FROM resources).
var userIDNullable string
err = conn.QueryRow(`
SELECT is_nullable FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = 'resources' AND column_name = 'user_id'`).Scan(&userIDNullable)
if err != nil {
t.Fatalf("resources.user_id nullabilité: %v", err)
}
if userIDNullable != "YES" {
t.Error("resources.user_id doit être NULLABLE après 000007 (migration douce, orphelines)")
}
// --- 000011 : index snapshot delta (LOT 4) -----------------------------
var ownerUpdatedIdx int
err = conn.QueryRow(`
SELECT COUNT(*) FROM pg_index i
JOIN pg_class t ON t.oid = i.indrelid
WHERE t.relname = 'resources' AND i.indisvalid
AND pg_get_indexdef(i.indexrelid) LIKE '%idx_resources_owner_updated_active%'`).Scan(&ownerUpdatedIdx)
if err != nil {
t.Fatalf("000011 index: %v", err)
}
if ownerUpdatedIdx == 0 {
t.Error("index idx_resources_owner_updated_active manquant après 000011")
}
// operation_id outbox = UUID 32-hex client-generated — cf. docs/api-v1.md §6.1
var opType string
err = conn.QueryRow(`