Skip to content

fix(invitations): re-check the sender's authority when an invite is accepted - #134

Open
kipavy wants to merge 1 commit into
mainfrom
fix/778-recheck-inviter-on-accept
Open

kipavy wants to merge 1 commit into
mainfrom
fix/778-recheck-inviter-on-accept

Conversation

@kipavy

@kipavy kipavy commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Part of VoltiusApp/voltius#778 (invite directly as Owner).

A pending invitation was only validated when sent. If the sender was later demoted, removed, or deleted their account, it still admitted the recipient with the stored roles for up to 7 days. With Owner invites in the client, a former Owner could mint a new Owner that way.

  • Every acceptance path (link token, in-app, registration auto-accept) goes through accept_pending_invitation, which now re-runs the send-time checks against invited_by: invite permission plus authority over each role still present. Roles deleted since are skipped, as admit_member already does.
  • Failure answers 410 Gone. A resend by a current admin stores them as sender and revives the invite.
  • Applies to every role, not only Owner. A departing admin's pending invites stop working; admins see them still pending and can resend.
  • add_member / invite_member share one require_can_invite guard.
  • seed_invitation now records the team owner as sender; seed_invitation_from takes an explicit one.

No migration. Rollback to sha-e649ce5 is safe.

Tests: 5 new in inviter_recheck_tests; full suite 952/952 against Postgres 17.

…ccepted

A pending invitation was validated only when it was sent. If the sender
was later demoted, removed from the team, or deleted their account, the
invite still admitted its recipient with the stored roles for up to
seven days. With Owner invites in the client (VoltiusApp/voltius#778)
that let a former Owner mint a new one.

Every acceptance path (link token, in-app invite, registration
auto-accept) now re-runs the send-time checks against the stored
sender: invite permission plus authority over each role still present.
A failed check answers 410 Gone. A resend from a current admin stores
them as the sender and revives the invite.

The duplicated invite-permission guard in add_member and invite_member
is now one helper. Test invitations carry the team owner as sender.
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