Skip to content

Commit

Permalink
UserValidator: Fix wrong Resource parameter in override validation …
Browse files Browse the repository at this point in the history
…SAR (#164)
  • Loading branch information
bastjan authored May 17, 2023
1 parent 7239094 commit 8f33e18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webhooks/user_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ func (v *UserValidator) Handle(ctx context.Context, req admission.Request) admis
if err := sar.AuthorizeResource(ctx, v.client, req.UserInfo, sar.ResourceAttributes{
Verb: "create",
Group: "rbac.appuio.io",
Resource: req.Resource.Group,
Resource: req.Resource.Resource,
Version: req.Resource.Version,
Name: req.Name,
}); err != nil {
log.Info("User not authorized to create other users", "request_user", req.AdmissionRequest.UserInfo, "user", req.Name, "error", err)
return admission.Denied(fmt.Sprintf("user %q is not allowed to create or update %q", req.UserInfo.Username, req.Name))
}
log.Info("User authorized to create other users", "user", req.AdmissionRequest.UserInfo)
Expand Down

0 comments on commit 8f33e18

Please sign in to comment.