Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default organization controller RBAC #212

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

simu
Copy link
Member

@simu simu commented Sep 25, 2024

Summary

Without this RBAC configuration, the default organization controller isn't allowed to modify arbitrary users, cf. the user webhook implementation:

// Allow the user to create or update itself.
// A special permission, used for controllers, `create rbac.appuio.io users` can override this.
if req.AdmissionRequest.Operation == admissionv1.Create && req.UserInfo.Username != req.Name {
if err := sar.AuthorizeResource(ctx, v.client, req.UserInfo, sar.ResourceAttributes{
Verb: "create",
Group: "rbac.appuio.io",
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)
}

Checklist

  • PR contains a single logical change (to build a better changelog).
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog.

@simu simu added the bug Something isn't working label Sep 25, 2024
@simu simu requested a review from a team as a code owner September 25, 2024 14:22
@simu simu changed the title Give default organization controller permissions to create/update arbitrary users Fix default organization controller RBAC Sep 25, 2024
@simu simu merged commit fd065b5 into master Sep 26, 2024
2 checks passed
@simu simu deleted the fix/default-org-controller-rbac branch September 26, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants