-
Notifications
You must be signed in to change notification settings - Fork 37
Enhance project access control in backend handlers #268
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
- Updated `GetProject`, `UpdateProject`, and `DeleteProject` functions to use `K8sClientProjects` for namespace retrieval, ensuring consistent access checks. - Introduced permission verification for viewing and modifying projects using `checkUserCanViewProject` and `checkUserCanModifyProject` functions. - Removed deprecated access check function and added error handling for permission verification failures. - Improved error responses for unauthorized access attempts. These changes enhance security and ensure proper access control for project management operations.
Code Review - PR #268: Enhance project access control in backend handlersOverall AssessmentThis PR improves RBAC enforcement for project management operations by introducing fine-grained permission checks using ✅ Strengths1. Proper RBAC GranularityThe PR correctly distinguishes between view (GET) and modify (UPDATE) permissions on
This is more precise than the previous 2. Security-First Design
3. Backward CompatibilityThe deprecated 4. Proper Error Handling
|
Code Review: Enhance Project Access ControlOverviewThis PR improves RBAC enforcement by switching from namespace-level to projectsettings resource-based permissions. Strengths
Issues and Recommendations1. Critical: Permission Check OrderIssue: GetProject/UpdateProject retrieve namespace with backend SA BEFORE checking user permissions. This could leak namespace existence information. Recommendation: Check permissions FIRST, then retrieve namespace. 2. Missing Test CoverageRequired: Add tests for:
Reference: CLAUDE.md mentions tests/integration/ and make test-permissions 3. Timeout ContextIssue: Permission checks use 2s timeout, namespace ops use 10s. Consider coordinating or reusing parent context. 4. Error MessagesLine 494 returns generic error without distinguishing infrastructure failures from authorization denials. 5. Verify RBAC RulesConfirm RoleBindings grant get/update verbs for vteam.ambient-code/projectsettings resource. Pre-Merge Checklist
Run: cd components/backend && gofmt -l . && go vet ./... && golangci-lint run && make test Overall: Approve with RecommendationsCore improvement is sound. Required before merge:
Great work on the granular permission model! |
Code Review: Enhance Project Access ControlThank you for this security improvement! I've reviewed the changes against the project's CLAUDE.md guidelines. Here's my feedback: ✅ Strengths
|
Code Review: Enhance Project Access ControlThank you for improving the security of project operations! This PR enhances RBAC enforcement by using more fine-grained permission checks. Here's my detailed review: ✅ Strengths
|
sallyom
left a comment
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.
LGTM
- Updated `GetProject`, `UpdateProject`, and `DeleteProject` functions to use `K8sClientProjects` for namespace retrieval, ensuring consistent access checks. - Introduced permission verification for viewing and modifying projects using `checkUserCanViewProject` and `checkUserCanModifyProject` functions. - Removed deprecated access check function and added error handling for permission verification failures. - Improved error responses for unauthorized access attempts. These changes enhance security and ensure proper access control for project management operations.
- Updated `GetProject`, `UpdateProject`, and `DeleteProject` functions to use `K8sClientProjects` for namespace retrieval, ensuring consistent access checks. - Introduced permission verification for viewing and modifying projects using `checkUserCanViewProject` and `checkUserCanModifyProject` functions. - Removed deprecated access check function and added error handling for permission verification failures. - Improved error responses for unauthorized access attempts. These changes enhance security and ensure proper access control for project management operations.
GetProject,UpdateProject, andDeleteProjectfunctions to useK8sClientProjectsfor namespace retrieval, ensuring consistent access checks.checkUserCanViewProjectandcheckUserCanModifyProjectfunctions.These changes enhance security and ensure proper access control for project management operations.