fix(ske): prevent usage of UUID for dns extension (#1025)
Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
This commit is contained in:
parent
55a9a430fc
commit
3769b43527
3 changed files with 65 additions and 0 deletions
|
|
@ -67,6 +67,23 @@ func UUID() *Validator {
|
|||
}
|
||||
}
|
||||
|
||||
func NoUUID() *Validator {
|
||||
description := "value must not be an UUID"
|
||||
|
||||
return &Validator{
|
||||
description: description,
|
||||
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||
if _, err := uuid.Parse(req.ConfigValue.ValueString()); err == nil {
|
||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||
req.Path,
|
||||
description,
|
||||
req.ConfigValue.ValueString(),
|
||||
))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// IP returns a validator that checks, if the given string is a valid IP address.
|
||||
// The allowZeroAddress parameter defines, if 0.0.0.0, resp. [::] should be considered valid.
|
||||
func IP(allowZeroAddress bool) *Validator {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue