secrets.go 423 B

1234567891011121314
  1. package validation
  2. import "fmt"
  3. // MaxSecretSize is the maximum byte length of the `Secret.Spec.Data` field.
  4. const MaxSecretSize = 500 * 1024 // 500KB
  5. // ValidateSecretPayload validates the secret payload size
  6. func ValidateSecretPayload(data []byte) error {
  7. if len(data) >= MaxSecretSize || len(data) < 1 {
  8. return fmt.Errorf("secret data must be larger than 0 and less than %d bytes", MaxSecretSize)
  9. }
  10. return nil
  11. }