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
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:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user