Repository navigation
feat(beyondleetcode): C35a Users: create an Invite link - #191
Open
GauranshMathur wants to merge 6 commits into
Open
GauranshMathur wants to merge 6 commits into
GauranshMathur wants to merge 6 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GauranshMathur
marked this pull request as ready for review
October 16, 2026 14:17
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
Author
Security review (orchestrator-dispatched, 2026-10-17)Verdict: fix first. Two readers on one shared brief (the card's decisions as a checklist), both read-only, cwd the C35a worktree at
(An earlier Codex run on 2026-10-16 never read the code: its sandbox could not start after a reboot. That run is not counted.) Must fix
Checked and fine (both readers)
Not blocking (Fable)
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The previous commit was reformatted by the wrong tool; this one restores the project's formatting. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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 creates an Invite on the Users page and is shown the link once; the database holds only the SHA-256 of the token. A pending Invite offers "Cancel invite" only. Per the orchestrator's decisions:
multiUsergainsinvites(built increateAppfromdband the ORIGIN already validated inbuildAuth), set onlocals.invitesin Multi-user Mode only.Checklist
prisma migrate diff: no difference), invites.ts + testsNotes for the security review
Behaviour beyond the card's wording:
invites.tsitself checksrole === 'admin'in create/listPending/cancel (throws NotAdminError), in addition to the actions' check.createresolves the creating User from Identity's learnerId.lookupreturns null for a token not shaped like 43 base64url characters without touching the database.cancelonly deletes unused rows (usedAt: null) and returns false for unknown/used/already-cancelled; the action answers all of those with the fixed 404 message "That invite is no longer pending."Cache-Control: no-storeis set once, in the hook (handle.ts), on every/usersresponse (page, data request, action result, error); see the security-review fix below. The link is in the action result only; the load returns pending{id, createdAt, expiresAt}.Reviews: self-review ran; Codex (read-only, diff only): no findings.
Security-review fix (no-JS 500)
A no-JS POST to
?/inviteruns the action and then the load in one request; both calledsetHeaders('Cache-Control'), so SvelteKit threw and the request answered 500 after the row was written. Fix: the per-route setters are removed andhandle.tssetsno-storeon the resolved response whenevent.route.id === '/users'. Why the hook: one place, so the header cannot be set twice, and it covers every kind of answer (HTML, enhanced action result,__data.json, error pages), wheresetHeadersonly reaches the ones the route code sets. Gate redirects and refusals already carriedno-store. Also moved the "A refused or failed switch" comment back aboveswitchRegistration.Tests: new e2e (JavaScript disabled) creates an Invite, sees 200,
no-storeand the link; it fails on the old code with"Cache-Control" header is already set(checked). A unit test pins the hook settingno-storeon 200 and 500/usersanswers; the existing tests now assert the header on the real response. Codex run skipped for this fix: the orchestrator re-runs the two-reader review.🤖 Generated with Claude Code