Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: don't fail on empty payload (#3569)

Danny Xu836e2a4abd8d
diff --git a/api/policy.go b/api/policy.go
index d01366e03d..f90b50c0bc 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -335,9 +335,6 @@ func ValidatePolicyType(pType PolicyType) error {
// ValidatePolicy will validate the policy resource type, type and payload values.
func ValidatePolicy(resourceType PolicyResourceType, pType PolicyType, payload *string) error {
- if payload == nil {
- return errors.Errorf("empty payload")
- }
hasResourceType := false
for _, rt := range allowedResourceTypes[pType] {
if rt == resourceType {
@@ -347,6 +344,10 @@ func ValidatePolicy(resourceType PolicyResourceType, pType PolicyType, payload *
if !hasResourceType {
return errors.Errorf("invalid resource type %s and policy type %s pair", resourceType, pType)
}
+ // If payload is not changed, we will not check its content.
+ if payload == nil {
+ return nil
+ }
switch pType {
case PolicyTypePipelineApproval: