Files
hatchet/pkg/repository/jsonb.go
T
matt 5bf9f97720 Fix: Validate payloads + metadata and error on illegal unicode (#2023)
* feat: add helper method to repository

* feat: 400 on event pushes with invalid payloads

* fix: pointer

* feat: add to trigger

* feat: error on bulk trigger

* feat: error on schedule

* fix: validate log lines

* feat: validate crons

* feat: fail the task

* fix: rm debug line
2025-07-20 22:44:28 -04:00

19 lines
317 B
Go

package repository
import (
"fmt"
"strings"
)
func ValidateJSONB(jsonb []byte, fieldName string) error {
if len(jsonb) == 0 {
return nil
}
if strings.Contains(string(jsonb), "\\u0000") {
return fmt.Errorf("encoded jsonb contains invalid null character \\u0000 in field `%s`", fieldName)
}
return nil
}