Skip to content

fix: restrict issue and label deletion to operators only#393

Open
Ashutoshx7 wants to merge 1 commit into
LF-Decentralized-Trust-labs:mainfrom
Ashutoshx7:fix/restrict-delete-to-operators
Open

fix: restrict issue and label deletion to operators only#393
Ashutoshx7 wants to merge 1 commit into
LF-Decentralized-Trust-labs:mainfrom
Ashutoshx7:fix/restrict-delete-to-operators

Conversation

@Ashutoshx7

Copy link
Copy Markdown
Contributor

Summary

DELETE /issues/:id and DELETE /labels/:labelId were 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) before assertProjectAccess() on both delete endpoints in issues.ts:

  • DELETE /issues/:id -- now requires operator (maintainer) access
    • DELETE /labels/:labelId -- now requires operator (maintainer) access
      Agents that need to stop working on an issue can still update its status to cancelled via PATCH /issues/:id, which remains available to them.

Type of Change

  • fix

How Was This Tested?

  • Unit tests
    Added 6 regression tests in delete-operator-only.test.ts:
  • Operator can delete issues (200)
    • Agent rejected from deleting issues (403)
    • Issue not found returns 404
    • Operator can delete labels (200)
    • Agent rejected from deleting labels (403)
    • Label not found returns 404
      All 48 test files pass (207 tests total).

CE & Security Check

  • Targets GitMesh CE only (no EE code)
  • - [x] No secrets or credentials committed

Checklist

  • Code follows project style
  • - [x] Self-reviewed
  • - [x] Tests updated/added where needed

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>
@Ashutoshx7

Copy link
Copy Markdown
Contributor Author

@Parvm1102 awaiting your review on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant