Repository navigation
Commit f4513f5
Owner checks on invite administration routes (#3066)
* Owner checks on invite administration routes
Restrict the invite-administration routes to the conversation's owner or a
moderator on the owner's site, the same ownership gate the data export and
conversation UUID routes already use.
Observable changes:
- GET and POST /api/v3/treevite/waves, GET /api/v3/treevite/invites and
GET /api/v3/treevite/invites/csv return 403 to callers who are neither the
owner nor a site moderator (previously any valid token received 200/201).
The admin UI, operated by the owner or a moderator, is unaffected.
- POST /api/v3/users/invite returns 403 to the same non-owner callers.
- GET /api/v3/conversations no longer treats an `xid` query parameter
specially: listing conversations no longer creates single-use invite rows as
a side effect, and each returned `url` is the ordinary conversation url. No
in-repo client sends `xid` to this route.
- POST /api/v3/treevite/acceptInvite records the invite against a participant
in the requested conversation (creating one when needed) rather than a
participant id carried by a token issued for a different conversation.
Legitimate first-time accepts continue to succeed.
The single-use invite insert is now a parameterised multi-row statement.
Tests (server integration + unit):
- For each gated route: a signed-in non-owner and an anonymous participant
token from another conversation receive 403; the owner and a site moderator
succeed.
- acceptInvite: a token from another conversation is scoped to the requested
conversation and is not rejected.
- GET /api/v3/conversations with an xid writes no invite rows.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
* tests: plain describe name for the accept-invite scoping case
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 0b9c529 commit f4513f5
9 files changed
Lines changed: 577 additions & 51 deletions
File tree
- server
- __tests__
- integration
- setup
- unit
- src
- invites
- routes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments