github.com/kaisenlinux/docker@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/validation/secrets.go (about) 1 package validation 2 3 import "fmt" 4 5 // MaxSecretSize is the maximum byte length of the `Secret.Spec.Data` field. 6 const MaxSecretSize = 500 * 1024 // 500KB 7 8 // ValidateSecretPayload validates the secret payload size 9 func ValidateSecretPayload(data []byte) error { 10 if len(data) >= MaxSecretSize || len(data) < 1 { 11 return fmt.Errorf("secret data must be larger than 0 and less than %d bytes", MaxSecretSize) 12 } 13 return nil 14 }