fix(security): close open findings from 2026-06-19 review (gateway auth, booking-engine price, SSRF, guest scope, +)#126
Merged
Conversation
…cope guest reuse by property - booking-engine quote/book: reject rate plan whose roomTypeId != requested roomType (price manipulation via independently-sellable room/rate ids) - connect-events: never return the HMAC subscription secret in create/list responses - connect + OTA inbound findOrCreateGuest: only reuse a guest already linked to the requesting property; otherwise create a fresh row (cross-tenant PII leak/poison) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…follow - assertSafeChannelEndpoint(): block private/internal/metadata hosts for tenant-supplied channel baseUrl in production (opt-out CHANNEL_ALLOW_PRIVATE_ENDPOINTS for local mocks) - wire into booking-com / expedia / siteminder adapter fetch paths - redirect:'manual' on adapter + webhook-delivery fetches so a 302 to an internal host cannot bypass the pre-flight URL validation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ion numbers
- reports.controller: @RequirePermissions('reports.view') so financial/occupancy
reports aren't readable by any authenticated property user (e.g. housekeeping)
- OTA inbound generateConfirmationNumber: reuse the 128-bit CSPRNG token instead of
Date.now()+Math.random() (was enumerable; confirmation # is a bearer credential)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The gateway injects HAIP's privileged platform Connect key on every upstream call, so an unauthenticated public gateway is an open door to cross-tenant Connect operations. Add an onRequest hook that requires a caller credential (Authorization: Bearer <key> or x-api-key) on all action routes; /health, /openapi.json, /privacy and the landing page stay public. Fail-closed: if no GATEWAY_API_KEY is configured and GATEWAY_ALLOW_PUBLIC!=true, action routes 401. Timing-safe comparison. Wired in server.ts + api/index.ts; documented in .env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ger in prod, demo warning - notifications: in-memory per-property SMS quota (toll-fraud/spam guard on the free-form, billable SMS endpoint); tunable via SMS_RATE_LIMIT_MAX/WINDOW_MS - assert-secure-config: enforce for 'staging' too (not just 'production') so a staging host can't silently boot with AUTH_ENABLED=false - main.ts: only mount Swagger /docs outside production (opt back in with SWAGGER_ENABLED=true) - render.yaml: loud DEMO-ONLY warning — auth-off blueprint is not a production template Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 19, 2026
telivity-otaip
added a commit
that referenced
this pull request
Jun 20, 2026
…il-open on bad config (#130) Independent codex review of #126-#128 found two gaps: - assertSafeChannelEndpoint only enforced for NODE_ENV=production, leaving staging open to SSRF even though this changeset hardened staging elsewhere. Now enforces for production OR staging (matches assertSecureConfig). - SMS quota parsed env with Number() and disabled on NaN, so SMS_RATE_LIMIT_MAX=garbage silently turned the limiter off. Now an invalid value falls back to the default (limiter stays on); only an explicit valid value <= 0 disables it. Co-authored-by: Claude Opus 4.8 <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.
Summary
Closes the open findings from the 2026-06-19 dual security review (Claude + Codex) against
origin/main. The earlier CRITICALs #2/#3 were already fixed (#118–#120); this PR closes the remaining exposed surface — led by the unauthenticated ChatGPT gateway (CRITICAL) and a new booking-engine price-manipulation bug (HIGH).All changes are TDD (test written first, watched fail, then pass). 1005/1005 API tests + 19/19 gateway tests pass; typecheck clean.
Fixes
tools/haip-connect-gpt):onRequesthook requiresAuthorization: Bearer <key>orx-api-key(timing-safe), fail-closed./health,/openapi.json,/privacy, landing stay public. Config:GATEWAY_API_KEY(+GATEWAY_ALLOW_PUBLIC=trueopt-out for the demo).quote/bookreject a rate plan whoseroomTypeId≠ the requested room type (was bookable at a cheaper room's rate with just the publishable key).findOrCreateGuestonly reuse a guest already linked to the requesting property; else create a fresh row (cross-tenant PII leak/poison).baseUrlSSRF:assertSafeChannelEndpointblocks private/metadata hosts in production (opt-outCHANNEL_ALLOW_PRIVATE_ENDPOINTSfor local mocks);redirect:'manual'on adapter + webhook-delivery fetches.secretno longer returned in create/list responses.@RequirePermissions('reports.view').SMS_RATE_LIMIT_MAX/_WINDOW_MS.Date.now()+Math.random())./docsgated out of production (SWAGGER_ENABLED=trueto opt in);assert-secure-confignow also enforces forstaging.Deploy note
The gateway fix requires
GATEWAY_API_KEYset in Vercel and in the ChatGPT Action's auth config — orGATEWAY_ALLOW_PUBLIC=trueto keep the public demo open.🤖 Generated with Claude Code