Skip to content

Commit cef38af

Browse files
fix: Validate topicID in upsert route
1 parent c37782d commit cef38af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/routes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ func (a *App) upsertTopic(c *gin.Context) {
551551
c.AbortWithStatusJSON(http.StatusBadRequest, err)
552552
return
553553
}
554+
if c.Param("topicID") != fmt.Sprintf("%d", r.ID) {
555+
c.AbortWithStatusJSON(http.StatusBadRequest, "Topic ID doesn't match")
556+
return
557+
}
554558
if len(r.Fields) == 0 {
555559
c.AbortWithStatusJSON(http.StatusBadRequest, "Please provide at least one question")
556560
return

0 commit comments

Comments
 (0)