Skip to content

fix(invite): enforce invitee ownership on accept and delete - #436

Merged
shreeharsha-factly merged 1 commit into
developfrom
fix/accept-invite-authz
Sep 25, 2026
Merged

shreeharsha-factly merged 1 commit into
developfrom
fix/accept-invite-authz

Conversation

@shreeharsha-factly

Copy link
Copy Markdown
Contributor

Accept took organisation_id and role from the request body and never checked the invitation belonged to the caller, letting any user join any organisation with any role. It also wrote the Keto tuple before the DB row and continued past the "already a member" check, which could leave an orphaned owner tuple.

Accept now loads the caller's own pending, unexpired invitation (row locked), takes organisation and role from it, returns on existing membership, and writes Keto last, removing the tuple if commit fails.

Delete now only removes invitations addressed to the caller and returns 404 otherwise.

Accept took organisation_id and role from the request body and never
checked the invitation belonged to the caller, letting any user join any
organisation with any role. It also wrote the Keto tuple before the DB
row and continued past the "already a member" check, which could leave
an orphaned owner tuple.

Accept now loads the caller's own pending, unexpired invitation (row
locked), takes organisation and role from it, returns on existing
membership, and writes Keto last, removing the tuple if commit fails.

Delete now only removes invitations addressed to the caller and returns
404 otherwise.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying kavach-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: ec4d405
Status: ✅  Deploy successful!
Preview URL: https://6e4a58ca.kavach-docs.pages.dev
Branch Preview URL: https://fix-accept-invite-authz.kavach-docs.pages.dev

View logs

@shreeharsha-factly
shreeharsha-factly merged commit 93aab74 into develop Sep 25, 2026
1 of 2 checks passed
@shreeharsha-factly
shreeharsha-factly deleted the fix/accept-invite-authz branch September 25, 2026 16:39
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