Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
fix: require images scope in IARs (#2062)
Browse files Browse the repository at this point in the history
Signed-off-by: Thorsten Klein <tk@thklein.io>
  • Loading branch information
iwilltry42 committed Aug 15, 2023
1 parent 2bb4167 commit c3e5fb2
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -13,8 +13,8 @@ type Validator struct{}

func (s *Validator) Validate(ctx context.Context, obj runtime.Object) (result field.ErrorList) {
aiar := obj.(*apiv1.ImageAllowRule)
if len(aiar.Images) == 0 && len(aiar.Signatures.Rules) == 0 {
return append(result, field.Invalid(field.NewPath(""), aiar, "at least one of scope or signatures must be specified"))
if len(aiar.Images) == 0 {
return append(result, field.Required(field.NewPath("images"), "the images scope must be set to define which images this rule applies to"))
}
result = append(result, validateSignatureRules(ctx, aiar.Signatures)...)
return
Expand Down

0 comments on commit c3e5fb2

Please sign in to comment.