fix(backend): harden write registrar boundaries

This commit is contained in:
2026-07-21 16:12:20 +08:00
parent 1fcbb31301
commit 80bec26839
17 changed files with 639 additions and 42 deletions

View File

@@ -93,15 +93,18 @@ func (h *Handler) update(c *gin.Context) {
httpx.Error(c, http.StatusBadRequest, "invalid_request", "请求参数无效")
return
}
nextProjectIdentity := ""
if strings.TrimSpace(input.NextProjectID) != "" {
if _, ok := parseIdentity(input.NextProjectID); !ok {
var valid bool
nextProjectIdentity, valid = parseIdentity(input.NextProjectID)
if !valid {
httpx.Error(c, http.StatusBadRequest, "invalid_identity", "nextProjectId 必须是 UUIDv7")
return
}
}
task, err := h.service.Update(userID, projectIdentity, taskIdentity, UpdateTaskInput{
Title: input.Title, Description: input.Description, Status: input.Status, Completed: input.Completed,
NextProjectIdentity: input.NextProjectID, Tag: input.Tag,
NextProjectIdentity: nextProjectIdentity, Tag: input.Tag,
})
if err != nil {
writeTaskError(c, err)