fix(incidents): use correct RBAC scopes for delete and read endpoints (fixes #5363)#6225
Open
asheesh-devops wants to merge 1 commit intokeephq:mainfrom
Open
fix(incidents): use correct RBAC scopes for delete and read endpoints (fixes #5363)#6225asheesh-devops wants to merge 1 commit intokeephq:mainfrom
asheesh-devops wants to merge 1 commit intokeephq:mainfrom
Conversation
- Change delete/bulk-delete/delete-alerts endpoints from write:incident to delete:incident to follow CRUD scope conventions - Fix read:incidents (plural) typo to read:incident (singular) for consistency with all other scope definitions Closes keephq#5363
98818d6 to
d0996b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes incorrect RBAC scope assignments in
incidents.pywhere delete endpoints usedwrite:incidentinstead ofdelete:incident, and some read endpoints usedread:incidents(plural) instead ofread:incident(singular).Root Cause
The delete and bulk-delete incident API endpoints were guarded with
write:incidentscope instead ofdelete:incident. This makes it impossible to create a role that can modify incidents but not delete them. Additionally, 3 read endpoints usedread:incidents(plural) which is inconsistent with every other scope in the codebase.The Fix
Update scope strings to follow CRUD conventions:
The
Adminrole already definesdelete:*wildcard scope inrbac.py, sodelete:incidentis properly matched.Changes
keep/api/routes/incidents.py— 6 scope string corrections (3 delete, 3 read)Testing
Adminrole hasdelete:*wildcard inrbac.pywhich matchesdelete:incidentread:incident,write:incident,read:alert,write:alert)Fixes #5363