fix(permissions): add a check for empty glob paths#5415
Conversation
Updated the project-permission service to consolidate permission conditions into a single object, improving readability and maintainability. Additionally, added a check in the CASL index to prevent empty glob paths from being processed.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile OverviewGreptile SummaryThis PR prevents empty glob patterns from being evaluated in CASL’s The backend change lives in the CASL condition interpreter used for permission rule evaluation, while the frontend change updates the service token creation modal’s zod schema and small layout tweaks for the scopes form. Confidence Score: 4/5
Important Files Changed
|
Added validation to ensure the secret path is not empty in the AddServiceTokenModal. Adjusted layout styles for better alignment of token scopes in the form, improving user experience.
|
@greptileai re-review and update the summary |
Additional Comments (1)
The new zod constraint ( |
Updated the AddServiceTokenModal to set a default secret path of "/" instead of an empty string. Additionally, modified the CASL index to trim whitespace from permission glob paths, preventing empty values from being processed.
Context
If the service token has an empty path, it would cause an error in the glob processor.
Screenshots
Steps to verify the change
Create a Service Token with an empty Secrets Path and try to call the secrets endpoints with that token.
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).