Skip to content

ref(api): Tighten accept-invite cleanup-delete path#114040

Merged
michelletran-sentry merged 1 commit intomasterfrom
fix/accept-invite-permissions
Apr 27, 2026
Merged

ref(api): Tighten accept-invite cleanup-delete path#114040
michelletran-sentry merged 1 commit intomasterfrom
fix/accept-invite-permissions

Conversation

@michelletran-sentry
Copy link
Copy Markdown
Contributor

Validate the invite token and pending state before the cleanup-delete branch of ApiInviteHelper runs, and scope member_already_exists to the authenticated user rather than any non-null user_id on the resolved record. Replace the duplicated delete in user_authenticator_enroll with a call through the helper so the new guard applies in both call sites.

@michelletran-sentry michelletran-sentry requested a review from a team April 27, 2026 14:14
@michelletran-sentry michelletran-sentry requested a review from a team as a code owner April 27, 2026 14:14
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 27, 2026
Comment thread src/sentry/api/invite_helper.py Outdated
return self.invite_context.user_id is not None
# Must match the authenticated request user — not merely "the resolved
# member has some user_id". When `_get_invite` falls through to the URL
# member_id lookup, `invite_context.user_id` is the _victim_'s user_id,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the code having the concept of a victim make sense, or is it only in relation to this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, ya it's related to bug bounty. Comment doesn't make sense without that context... will remove. Thanks for the catch!

Validate the invite token and pending state before the cleanup-delete
branch of ApiInviteHelper runs, and scope `member_already_exists` to
the authenticated user rather than any non-null user_id on the
resolved record. Replace the duplicated delete in
user_authenticator_enroll with a call through the helper so the new
guard applies in both call sites.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@michelletran-sentry michelletran-sentry merged commit 971c3ea into master Apr 27, 2026
56 checks passed
@michelletran-sentry michelletran-sentry deleted the fix/accept-invite-permissions branch April 27, 2026 14:39
cleptric pushed a commit that referenced this pull request May 5, 2026
Validate the invite token and pending state before the cleanup-delete
branch of ApiInviteHelper runs, and scope `member_already_exists` to the
authenticated user rather than any non-null user_id on the resolved
record. Replace the duplicated delete in user_authenticator_enroll with
a call through the helper so the new guard applies in both call sites.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants