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
+20 -2
View File
@@ -13,11 +13,11 @@ var expectedRoutes = []string{
"GET /api/v1/shares/links/:token",
"GET /api/v1/files",
"GET /api/v1/files/search",
"GET /api/v1/files/folders",
"GET /api/v1/files/:id",
"GET /api/v1/files/:id/ocr",
"DELETE /api/v1/files/:id",
"GET /api/v1/files/search",
"GET /api/v1/files/folders",
"POST /api/v1/files/upload",
"GET /api/v1/users/resolve",
@@ -44,3 +44,21 @@ func TestRoutesMatchClientContract(t *testing.T) {
}
}
// TestStaticFileRoutesListedBeforeParam (LOT 6 §1) : verrouille que les routes
// statiques /files/search et /files/folders restent déclarées avant
// /files/:id dans le contrat. Gin priorise déjà le statique sur le paramétré
// à l'exécution, mais l'ordre source documente l'intention ("/files/folders
// ne doit jamais être avalé par FilesGet avec id="folders"). Le comportement
// réel est couvert côté handlers (folders→200, :id="folders"→404).
func TestStaticFileRoutesListedBeforeParam(t *testing.T) {
index := map[string]int{}
for i, r := range expectedRoutes {
index[r] = i
}
for _, static := range []string{"GET /api/v1/files/search", "GET /api/v1/files/folders"} {
if index[static] > index["GET /api/v1/files/:id"] {
t.Errorf("contrat: %q doit rester listé avant %q (ordre §1)", static, "GET /api/v1/files/:id")
}
}
}