feat: add auth can I operation - #12
Conversation
Signed-off-by: Calum Murray <cmurray@redhat.com>
📝 WalkthroughWalkthroughThis pull request implements Kubernetes permission checking via a new "authCanI" operation. Changes include adding dependencies, creating a handler and tests for the operation, extending the resource client with SubjectAccessReview-based authorization checks, initializing an authorization client, and registering the operation. Changes
Sequence DiagramsequenceDiagram
participant User as User/Client
participant Handler as handleAuthCanI
participant Client as ResourceClient
participant K8s as Kubernetes API
User->>Handler: OperationRequest (verb, resource, as, namespace, etc.)
Handler->>Handler: Validate required parameters
Handler->>Client: CheckAccess(user, verb, resource, apiGroup, namespace, resourceName)
Client->>K8s: Create SubjectAccessReview
K8s-->>Client: SubjectAccessReview result (Allowed, Reason)
Client-->>Handler: (allowed bool, reason string, error)
Handler->>Handler: Check against expect (if provided)
Handler-->>User: OperationResult (Success with allowed/reason outputs)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
LGTM tests still running |
Seems like github actions is struggling... |
This PR adds support for checking Auth for a user (to enable testing RBAC configurations)
Summary by CodeRabbit
Release Notes
New Features
Chores