You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(chat): bound deployed-chat callers and stop leaking chat gate config
Two authorization/throttling defects on chat deployments.
**Denial of wallet on POST /api/chat/[identifier].** A deployed chat resolves
its execution principal from the workflow's workspace, so the plan rate bucket,
the usage/credit check and the concurrency reservation all belong to the owner
while the request belongs to whoever found the link. Nothing bounded the caller,
and an abort refunds none of it. Both the per-IP and the per-deployment bucket
now run after auth and before `preprocessExecution`, on every execution
regardless of `authType` — an email or SSO visitor is still not the payer.
`GET /api/chat/validate` answered for any anonymous caller, so `available:false`
inventoried live deployments; it now needs a session and a per-user bucket.
**Chat gate config exposed at workflow `read` on GET /api/workflows/[id]/chat/
status.** The route reimplemented the admin-gated detail projection inline,
serving the `allowedEmails` allow-list, `hasPassword` and the customization blob
to any workspace viewer, and asserting no `deploy.chat` capability. It is now an
adapter over `chat_deployments.list` — the same operation `GET /api/v2/chat-
deployments` binds — returning only the deployment's id and identifier, which is
all the editor reads before fetching the detail from `/api/chat/manage/{id}`.
The two buckets are the existing `enforceIpRateLimitWithIndependentBackstop`
plus a new `enforceResourceRateLimit` beside its siblings in `route-helpers`.
The IP bucket is consulted first and returns on refusal, so one flooding IP
cannot drain the deployment's budget and 429 the real audience with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QWh9WFMYNZ6uTFQFUzF8Bj
0 commit comments