From 2a0e9eadf04eee90b55921ad33502fb9c39b65f0 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Thu, 24 Oct 2024 09:44:23 -0500 Subject: [PATCH 1/2] add missing manager field in response Signed-off-by: Mike Mason --- internal/query/roles_v2.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/query/roles_v2.go b/internal/query/roles_v2.go index dbae851b..39442702 100644 --- a/internal/query/roles_v2.go +++ b/internal/query/roles_v2.go @@ -83,6 +83,7 @@ func (e *engine) CreateRoleV2(ctx context.Context, actor, owner types.Resource, return types.Role{}, err } + role.Manager = dbRole.Manager role.CreatedBy = dbRole.CreatedBy role.UpdatedBy = dbRole.UpdatedBy role.ResourceID = dbRole.ResourceID From 2e5c720084b681a2fab5a6334be1f7cf08f53782 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Thu, 24 Oct 2024 09:45:12 -0500 Subject: [PATCH 2/2] validate that action and type names are configured Signed-off-by: Mike Mason --- internal/iapl/policy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/iapl/policy.go b/internal/iapl/policy.go index 2eb55f80..f58dcd0d 100644 --- a/internal/iapl/policy.go +++ b/internal/iapl/policy.go @@ -388,6 +388,14 @@ func (v *policy) validateActionBindings() error { bindingMap := make(map[bindingMapKey]struct{}, len(v.p.ActionBindings)) for i, binding := range v.bn { + if binding.ActionName == "" { + return fmt.Errorf("%d (%s:%s): %w", i, binding.TypeName, binding.ActionName, ErrorUnknownAction) + } + + if binding.TypeName == "" { + return fmt.Errorf("%d (%s:%s): %w", i, binding.TypeName, binding.ActionName, ErrorUnknownType) + } + key := bindingMapKey{ actionName: binding.ActionName, typeName: binding.TypeName,