forked from ebhomengo/niki
1
0
Fork 0

🔒fix(delivery): fixed the security problem of the create benefactor kinfboxreq

This commit is contained in:
mohammad mahdi rezaei 2024-01-24 18:44:13 +03:30
parent d829192bd6
commit aa129a870e
1 changed files with 3 additions and 2 deletions

View File

@ -10,11 +10,12 @@ import (
) )
func (h Handler) Add(c echo.Context) error { func (h Handler) Add(c echo.Context) error {
claims := claim.GetClaimsFromEchoContext(c) req := param.KindBoxReqAddRequest{}
req := param.KindBoxReqAddRequest{BenefactorID: claims.UserID}
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest) return echo.NewHTTPError(http.StatusBadRequest)
} }
claims := claim.GetClaimsFromEchoContext(c)
req.BenefactorID = claims.UserID
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil { if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil {
msg, code := httpmsg.Error(err) msg, code := httpmsg.Error(err)