fix: restrict issue and label deletion to operators only#393
Open
Ashutoshx7 wants to merge 1 commit into
Open
Conversation
DELETE /issues/:id and DELETE /labels/:labelId were accessible to any actor with project access, including agents. These are hard deletes that permanently remove data, which isn't something agents should be doing — the v1 spec permission matrix only gives agents create/update on tasks, not delete. Added assertBoard() before assertProjectAccess() on both routes so only operators can perform destructive deletions. Includes six regression tests covering operator success, agent rejection, and not-found cases for both endpoints. Signed-off-by: Ashutoshx7 <as1142120@gmail.com>
Contributor
Author
|
@Parvm1102 awaiting your review on this |
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
DELETE /issues/:idandDELETE /labels/:labelIdwere accessible to any actor with project access, including agents. Both are hard deletes that permanently remove data from the database.The v1-spec permission matrix (section 9.3) only grants agents "Create/update task: yes" -- deletion is not listed as an agent capability. Other destructive operations in the codebase (agent terminate, secret delete, etc.) already enforce
assertBoard()to restrict them to operators.What changed
Added
assertBoard(req)beforeassertProjectAccess()on both delete endpoints inissues.ts:DELETE /issues/:id-- now requires operator (maintainer) accessDELETE /labels/:labelId-- now requires operator (maintainer) accessAgents that need to stop working on an issue can still update its status to
cancelledviaPATCH /issues/:id, which remains available to them.Type of Change
How Was This Tested?
Added 6 regression tests in
delete-operator-only.test.ts:All 48 test files pass (207 tests total).
CE & Security Check
Checklist