Implementing Granular User Permission Controls for Secrets API endpoints
What does this MR do and why?
This merge request implements a permissions system for GitLab's Secrets Management feature. The key components include:
-
User Authentication Module:
- Updates the existing
SecretsManagement::SecretManagerClientto authenticate a specific user.
- Updates the existing
-
Permission Management:
- Enhances
SecretPermissionmodel with improved validation for roles and member roles - Updates permission handling to track who granted permissions
- Adds internal permissions like 'list' and 'scan'
- Enhances
-
User-based Access Control:
- Implements
UserClientHelperto create authenticated clients for users - Updates services to use user-specific clients for operations like creating, reading, updating, and deleting secrets
- Modifies the project secrets manager provisioning to set up proper user authentication
- Implements
-
Default Owner Permissions:
- Automatically creates owner-level permissions during provisioning
- Ensures project owners have full access to secrets by default
-
Testing:
- Adds comprehensive tests for the new permission system
- Includes test fixtures for JWT authentication
The implementation allows for fine-grained access control to secrets based on user roles, group membership, and custom member roles, with proper validation to ensure permissions are only granted to users with appropriate access to the project.
References
Issue Link: #524412 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Shabini Rajadas