Stop accepting team invitations through GET requests - #188
Draft
WendellAdriel wants to merge 3 commits into
Draft
Conversation
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.
Overview
Accepting a team invitation ran behind a GET route in every teams variant: the Inertia controller performed the writes directly, and the Livewire page accepted from
mount(). GET also answers HEAD and skips CSRF, so anything that merely fetched the URL — link prefetchers, mail scanners, HEAD probes — created the membership, marked the invitation accepted, and switched the user's current team. Since #120 the invitation email links to the login page, so nothing needs this URL to be navigable.Solution
The Inertia kits now expose the accept route as POST — Wayfinder regenerates the action with the new method and
router.visit()follows it, so the modals need no changes (decline already works this way as a DELETE). The Livewire kits accept the invitation inside the pending invitations modal action, mirroring decline, and the navigable accept page and its route are gone. The direct-URL browser test was removed; the modal-based test keeps covering the flow end to end.Fixes #186