package utpl import "slices" type RawPolicy interface { Validate(param string, value string) error } type RawAllowlist map[string][]string func (a RawAllowlist) Validate(param string, value string) error { allowed, ok := a[param] if !ok { return &UnsafeRawError{Param: param, Value: value, Message: "no allowlist defined"} } if slices.Contains(allowed, value) { return nil } return &UnsafeRawError{Param: param, Value: value, Message: "value not in allowlist"} } type RawBlocklist map[string][]string func (b RawBlocklist) Validate(param string, value string) error { blocked, ok := b[param] if !ok { return nil } if slices.Contains(blocked, value) { return &UnsafeRawError{Param: param, Value: value, Message: "value is blocked"} } return nil } type RawNoop struct{} func (RawNoop) Validate(string, string) error { return nil }