Skip to content

fix: PR B — trust boundaries (round 4, bugs 5/6/8/9)#79

Merged
telivity-otaip merged 1 commit into
mainfrom
fix/pr-b-trust-boundaries
Apr 18, 2026
Merged

fix: PR B — trust boundaries (round 4, bugs 5/6/8/9)#79
telivity-otaip merged 1 commit into
mainfrom
fix/pr-b-trust-boundaries

Conversation

@telivity-otaip
Copy link
Copy Markdown
Collaborator

Summary

Second of 4 PRs from round-4 codex review. Closes auth and PII leaks at integration seams.

# Severity Bug Fix
5 HIGH WebSocket `joinProperty` unauthenticated JWKS-backed WsAuthService + property_id claim check
6 HIGH Guest PII cross-property `propertyId` required + reservation-link assertion
8 HIGH Stripe webhook signature broken (no raw body) `express.raw` on webhook path before JSON parser
9 HIGH JWT `aud` not validated `audience` option + `azp` check in validate()

CLAUDE.md

Guests exception corrected: the row is cross-property but API access MUST verify a reservation link at the requesting property.

Test plan

  • `pnpm build` green
  • `pnpm typecheck` green
  • `pnpm test` — 553/553

🤖 Generated with Claude Code

Bug 5 (HIGH): WebSocket joinProperty unauthenticated
- New WsAuthService (JWKS-backed, mirrors JwtStrategy)
- Gateway verifies JWT on handleConnection, disconnects invalid sockets
- joinProperty rejects unless user's JWT has the requested property_id
  (platform/admin roles bypass). AUTH_ENABLED=false preserves dev bypass.

Bug 6 (HIGH): Guest PII cross-property leakage
- All /guests/:id reads/updates/deletes + search now require propertyId
- assertGuestAtProperty verifies ≥1 reservation at requesting property
- Search uses inArray subquery scoped to reservations.propertyId
- Create intentionally unscoped (walk-ins have no reservation yet)

Bug 8 (HIGH): Stripe webhook signature verification broken
- express.raw installed on /api/v1/webhooks/stripe before global JSON
- Controller uses raw Buffer for stripe.webhooks.constructEvent

Bug 9 (HIGH): JWT audience not validated
- passport-jwt audience option enforced
- azp claim also validated in validate() for Keycloak compatibility
- KEYCLOAK_AUDIENCE documented in .env.example

CLAUDE.md: guests exception corrected to require reservation-link check.

553/553 tests passing, build + typecheck clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@telivity-otaip telivity-otaip merged commit d301937 into main Apr 18, 2026
2 of 3 checks passed
@telivity-otaip telivity-otaip deleted the fix/pr-b-trust-boundaries branch April 18, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant