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
+9 -1
View File
@@ -2,6 +2,7 @@ package handlers
import (
"errors"
"log"
"github.com/gin-gonic/gin"
"github.com/kazier/backend/pkg/api"
@@ -28,6 +29,13 @@ func writeError(c *gin.Context, err error) {
case errors.Is(err, service.ErrFileTooLarge):
api.Error(c, 413, "FILE_TOO_LARGE", "file exceeds the maximum allowed size")
default:
api.Error(c, 500, "INTERNAL", err.Error())
// Jamais de err.Error() brut au client (fuite SQL/FS/paths, cf.
// FEEDBACK #8) : message générique, détail au log serveur.
path := ""
if c.Request != nil && c.Request.URL != nil {
path = c.Request.URL.Path
}
log.Printf("internal error: path=%s err=%v", path, err)
api.Error(c, 500, "INTERNAL", "internal error")
}
}