-
Notifications
You must be signed in to change notification settings - Fork 713
fix: rbac for native user for license call #9530
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
Conversation
Signed-off-by: Yashodhan Joshi <[email protected]>
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryThis PR fixes an RBAC issue for native users accessing the license endpoint by adding a special case in the authentication validator. When a user is not found in the current organization but the request path is Key Changes
Issues Found
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant validator.rs
participant org_users.rs
participant Database
Client->>validator.rs: Request to /license endpoint
validator.rs->>validator.rs: Extract path and user_id
validator.rs->>validator.rs: Check if user exists in org
alt User not found in org
validator.rs->>validator.rs: Check if path == "license"
validator.rs->>org_users.rs: list_orgs_by_user(user_id)
org_users.rs->>Database: Query user's orgs
Database-->>org_users.rs: Return list of orgs
org_users.rs-->>validator.rs: Return org list
alt User belongs to at least one org
validator.rs-->>Client: Return TokenValidationResponse (valid=true, role=User)
else User belongs to no orgs
validator.rs-->>Client: Return TokenValidationResponse (valid=false)
end
else User found in org
validator.rs-->>Client: Continue with normal validation
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.
1 file reviewed, 1 comment
src/handler/http/auth/validator.rs
Outdated
| // logged in. So here we check if the user id is part of atleast one | ||
| // org, and if so, allow the call. If the user is not part of the current org | ||
| // rest of api calls will get blocked anyways, but without this, | ||
| // native users get stuck in logout loop if they go t any page calling license |
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.
syntax: typo: "go t any" should be "go to any"
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/handler/http/auth/validator.rs
Line: 207:207
Comment:
**syntax:** typo: "go t any" should be "go to any"
How can I resolve this? If you propose a fix, please make it concise.Signed-off-by: Yashodhan Joshi <[email protected]>
#9529 for v0.30.0