From 0c2b59b94e753f6faec1e7133c5a0f90c8c675ac Mon Sep 17 00:00:00 2001 From: Ronen Hilewicz Date: Sat, 13 Jul 2024 14:08:02 -0400 Subject: [PATCH] Check for nil permissions terms during model validation --- model/validate.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/model/validate.go b/model/validate.go index 7ab5867..f45d630 100644 --- a/model/validate.go +++ b/model/validate.go @@ -161,6 +161,12 @@ func (v *validator) validateObjectPerms(on ObjectName, o *Object) error { } for _, term := range terms { + if term == nil { + errs = multierror.Append(errs, derr.ErrInvalidPermission.Msgf( + "permission '%s:%s' has an empty term", on, pn), + ) + continue + } switch { case term.IsArrow(): // this is an arrow operator.