-
Notifications
You must be signed in to change notification settings - Fork 0
Add Groups resource type and scopes to authorization schema #5
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
base: feature-groups-authz-baseline
Are you sure you want to change the base?
Add Groups resource type and scopes to authorization schema #5
Conversation
…ation implementation Closes #35562 Signed-off-by: vramik <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile OverviewConfidence Score: 1/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Admin Client
participant GRes as GroupsResource
participant GPerm as GroupPermissionsV2
participant Schema as AdminPermissionsSchema
participant AuthZ as AuthorizationProvider
Client->>GRes: Request to view groups
GRes->>GPerm: Check canView()
alt Has admin role
GPerm-->>GRes: Permitted by role
else Check fine-grained authz
GPerm->>Schema: Get Groups resource type
GPerm->>AuthZ: Evaluate permission
AuthZ-->>GPerm: Permission result
GPerm-->>GRes: Permitted by policy
end
alt User authorized
GRes->>GPerm: Filter groups - canView(group)
loop Each group
GPerm->>Schema: Get group resource
GPerm->>AuthZ: Evaluate group permission
AuthZ-->>GPerm: Allowed or denied
end
GRes-->>Client: Filtered group list
else Not authorized
GRes-->>Client: ForbiddenException
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
19 files reviewed, 1 comment
| return true; | ||
| } | ||
|
|
||
| return hasPermission(null, AdminPermissionsSchema.VIEW, AdminPermissionsSchema.MANAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: canManage() incorrectly checks VIEW scope - should only check MANAGE scope
| return hasPermission(null, AdminPermissionsSchema.VIEW, AdminPermissionsSchema.MANAGE); | |
| return hasPermission(null, AdminPermissionsSchema.MANAGE); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: services/src/main/java/org/keycloak/services/resources/admin/permissions/GroupPermissionsV2.java
Line: 70:70
Comment:
**logic:** `canManage()` incorrectly checks `VIEW` scope - should only check `MANAGE` scope
```suggestion
return hasPermission(null, AdminPermissionsSchema.MANAGE);
```
How can I resolve this? If you propose a fix, please make it concise.
Test 6
Replicated from ai-code-review-evaluation/keycloak-greptile#6