Skip to content

fix: accept long hCaptcha tokens in chat requests - #1261

Merged
BenjaminMichaelis merged 2 commits into
mainfrom
bmichaelis-investigating-chat-400s
Aug 7, 2026
Merged

fix: accept long hCaptcha tokens in chat requests#1261
BenjaminMichaelis merged 2 commits into
mainfrom
bmichaelis-investigating-chat-400s

Conversation

@BenjaminMichaelis

Copy link
Copy Markdown
Member

Why

Live hCaptcha tokens can exceed the app's 2000-character request limit. That caused /api/chat/stream to fail model validation with a 400 before the chat endpoint could verify the token or process the request.

What changed

This removes the CaptchaResponse length cap from ChatMessageRequest so the backend accepts valid hCaptcha tokens of varying length.

It also adds an integration test that posts an oversized captcha token to the chat stream endpoint and verifies the request reaches normal endpoint handling instead of failing request model validation.

Notes

hCaptcha's documentation does not publish a fixed maximum token length and explicitly warns against URL-based verification when parameters are too long. This change avoids relying on an application-level limit that is smaller than the provider's live tokens.

@BenjaminMichaelis
BenjaminMichaelis merged commit 0fa24aa into main Aug 7, 2026
5 checks passed
@BenjaminMichaelis
BenjaminMichaelis deleted the bmichaelis-investigating-chat-400s branch August 7, 2026 07:35
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