Skip to content

PRDCT-547: harden the Ask Kai proxy (timeout, CORS allowlist, message cap) - #1011

Draft
Iamfle4ka wants to merge 1 commit into
mainfrom
fix/chat-proxy-hardening
Draft

PRDCT-547: harden the Ask Kai proxy (timeout, CORS allowlist, message cap)#1011
Iamfle4ka wants to merge 1 commit into
mainfrom
fix/chat-proxy-hardening

Conversation

@Iamfle4ka

Copy link
Copy Markdown
Collaborator

Hardening of the api/chat.ts Vercel proxy, found during an infra audit:

  • Enforce the 15s budget on the in-flight fetch (AbortSignal.timeout per attempt) — previously a single hung upstream connection blocked past the budget because the abort signal was never passed to fetch.
  • CORS: echo only trusted origins (help.keboola.com, *.vercel.app previews, localhost) instead of * — foreign pages can no longer script the proxy against our shared Storage token / AI quota.
  • Cap message length at 2000 chars to protect the shared AI quota.
  • Generic error to the client; the real error is logged server-side instead of echoing internals.

Draft: no Linear issue attached yet — retitle with a PRDCT id before the title gate from #1002 lands.

🤖 Generated with Claude Code

- enforce the 15s budget on the in-flight fetch (AbortSignal.timeout per
  attempt) — a hung upstream connection no longer blocks past the budget
- CORS: echo only trusted origins (help.keboola.com, *.vercel.app previews,
  localhost) instead of wildcard — foreign pages can't script the proxy
- cap message length (2000 chars) to protect the shared AI quota
- return a generic error to the client; log the real one server-side

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
connection-docs Ready Ready Preview, Comment Jul 9, 2026 12:39pm

Request Review

@Iamfle4ka Iamfle4ka changed the title fix(chat): harden the Ask Kai proxy (timeout, CORS allowlist, message cap) PRDCT-547: harden the Ask Kai proxy (timeout, CORS allowlist, message cap) Jul 15, 2026
@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

PRDCT-547

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