Merge pull request #828 from Gara-Dorta/additional-api-checks

refactor: add missing checks on required fields
This commit is contained in:
Bernhard B. 2026-04-09 22:18:55 +02:00 committed by GitHub
commit 2838e1f879
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -873,6 +873,11 @@ func (a *Api) AddMembersToGroup(c *gin.Context) {
return
}
if len(req.Members) == 0 {
c.JSON(400, Error{Msg: "Couldn't process request - group members missing"})
return
}
err = a.signalClient.AddMembersToGroup(number, groupId, req.Members)
if err != nil {
switch err.(type) {
@ -1279,6 +1284,16 @@ func (a *Api) UnpinMessageInGroup(c *gin.Context) {
return
}
if req.TargetAuthor == "" {
c.JSON(400, Error{Msg: "Couldn't process request - target author missing"})
return
}
if req.Timestamp == 0 {
c.JSON(400, Error{Msg: "Couldn't process request - timestamp missing"})
return
}
err = a.signalClient.UnpinMessageInGroup(number, groupId, req.TargetAuthor, req.Timestamp)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
@ -2385,6 +2400,16 @@ func (a *Api) SubmitRateLimitChallenge(c *gin.Context) {
return
}
if req.ChallengeToken == "" {
c.JSON(400, Error{Msg: "Couldn't process request - challenge token missing"})
return
}
if req.Captcha == "" {
c.JSON(400, Error{Msg: "Couldn't process request - captcha missing"})
return
}
err = a.signalClient.SubmitRateLimitChallenge(number, req.ChallengeToken, req.Captcha)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})