BUG: Invite route allows editors to invite members, contradicting domain model #5
Labels
No labels
blocked:needs-decision
bug
chore
in-progress
security/high
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AuWoMe/planish#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The invite API route (
/api/trips/[tripId]/invite) allows any editor to invite new members, but the domain entity (Trip.canManageMembers()) specifies that only the owner can manage members.The Issue
In
src/app/api/trips/[tripId]/invite/route.ts(line 19):This allows editors (
role === "editor") to invite members. However, the domain entity insrc/domain/entities/trip.ts(line 161-163) says:Additionally, the UI only shows the Invite button when
canEditis true (which includes editors), further enabling this behavior.Impact
Fix
Change the invite route to only allow the trip owner to invite:
Fixed in commit
a5510ba: invite route only blocked viewers, so editors could invite members (and inject any role, including owner). Now owner-only (matches Trip.canManageMembers), role validated to editor/viewer, self-invite rejected.