Repository navigation
Fix(security): re-enable admin role check on stakeholder delete route - #2889
Merged
Merged
Conversation
hanapotski
reviewed
Sep 29, 2026
hanapotski
left a comment
Contributor
There was a problem hiding this comment.
Thanks for catching this! Restoring the admin guard on DELETE /:id is the right fix: it matches the rest of the stakeholder routes, and the client already only enables Delete for admins, so nobody who should be able to delete loses access. I checked out the branch and ran npx jest --ci __test__/stakeholder-controller.test.ts, and all 8 tests pass.
Two inline notes on the new tests, plus two related issues outside this diff that the delete path now depends on. These could be follow-ups rather than blockers:
client/src/components/Admin/OrganizationEdit.tsx(~L741): the Delete button callsstakeholderService.remove(values.id)without awaiting or catching it, then immediately callshandleSubmit(). Now that this route can legitimately return 401 (for example, an expired session), a failed delete is silently ignored: the form still saves and navigates away as if the org was deleted. Even when the delete succeeds, the PUT races the DELETE for the same id.server/app/controllers/stakeholder-controller.ts(~L222):remove's catch block callsres.status(500)but never sends a response, so a DB error leaves the request hanging until it times out.res.sendStatus(500)would fix it.
🤖 Written by Claude on behalf of @hanapotski
jazxbx
force-pushed
the
fix/stakeholder-delete-auth-check
branch
from
October 26, 2026 22:21
da21163 to
fd23f10
Compare
SAUMILDHANKAR
self-requested a review
October 27, 2026 15:09
SAUMILDHANKAR
approved these changes
Nov 2, 2026
junjun107
force-pushed
the
fix/stakeholder-delete-auth-check
branch
from
December 1, 2026 00:51
fd23f10 to
a72ca90
Compare
Member
|
@hanapotski All four points are addressed:
I also rebased onto develop to pick up the Playwright CI fix |
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.
Admin role check on Delete /api/stakeholders/:id was commented out, letting anyone delete any stakeholder without auth. Uncommented the line to restore the check.
tests: