fix(events): enforce series-pass, hidden, and deadline gates
Pre-launch P0 fixes surfaced by docs/specs/events-functional-test-matrix.md (Findings 1, 2, 3). 1. Series-pass bypass (Finding 1 / matrix S1 P3): register.post.js now loads the linked Series when tickets.requiresSeriesTicket is set and rejects drop-in registration unless series.allowIndividualEventTickets is true or the user has a valid pass. Data-integrity 500 if the referenced series is missing. 2. Hidden-event leak (Finding 2 / matrix E11): extract loadPublicEvent into server/utils/loadEvent.js. All five public event endpoints ([id].get, register, tickets/available, tickets/reserve, tickets/purchase) now go through the helper, which 404s when isVisible === false and the requester is not an admin. Admin detection uses a new non-throwing getOptionalMember() in server/utils/auth.js (extracted from the pattern already inlined in api/auth/status.get.js). 3. Deadline enforcement + legacy pricing retirement (Finding 3 / matrix E8): register.post.js and tickets/reserve.post.js delegate gating to validateTicketPurchase (which already covers deadline, cancelled, started, members-only, sold-out, and already-registered); tickets/available.get.js gets an explicit registrationDeadline check. Legacy pricing.paymentRequired 402 branch removed from register.post.js.
This commit is contained in:
parent
6a6c567fd5
commit
f34b062f2a
11 changed files with 746 additions and 247 deletions
|
|
@ -15,12 +15,14 @@ describe('register.post.js', () => {
|
|||
expect(source).toContain('email.toLowerCase()')
|
||||
})
|
||||
|
||||
it('checks membersOnly restriction', () => {
|
||||
expect(source).toContain('membersOnly')
|
||||
it('uses validateTicketPurchase for gating (covers membersOnly, deadline, sold-out, etc.)', () => {
|
||||
expect(source).toContain('validateTicketPurchase(')
|
||||
})
|
||||
|
||||
it('checks capacity via maxAttendees', () => {
|
||||
expect(source).toContain('maxAttendees')
|
||||
it('enforces series-pass gate via checkUserSeriesPass', () => {
|
||||
expect(source).toContain('checkUserSeriesPass(')
|
||||
expect(source).toContain('requiresSeriesTicket')
|
||||
expect(source).toContain('seriesTicketReference')
|
||||
})
|
||||
|
||||
it('does not let email failure block registration', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue