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
+13 -1
View File
@@ -1,6 +1,10 @@
package api
import "github.com/gin-gonic/gin"
import (
"log"
"github.com/gin-gonic/gin"
)
const NotImplementedCode = "NOT_IMPLEMENTED"
@@ -22,6 +26,14 @@ func OKList(c *gin.Context, data any, page, pageSize, total int) {
}
func Error(c *gin.Context, status int, code, message string) {
// LOT 6 §5 : le client ne reçoit que l'enveloppe générique (code +
// message sans détail interne — jamais de err.Error() brut). Le détail
// va au log serveur pour le diagnostic.
path := ""
if c.Request != nil && c.Request.URL != nil {
path = c.Request.URL.Path
}
log.Printf("api error: status=%d code=%s message=%s path=%s", status, code, message, path)
c.JSON(status, gin.H{
"error": gin.H{"code": code, "message": message},
})