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: captcha dev bypass and HTTP/2 connection header
- ChatController: inject IOptions<CaptchaOptions>; skip captcha check entirely when SiteKey is not configured (local dev without hCaptcha secrets)
- ChatController: wrap CaptchaService.VerifyAsync in try-catch to fail-open on InvalidOperationException (missing SecretKey)
- ChatController: remove Response.Headers.Connection = keep-alive (invalid in HTTP/2, generated ASP.NET warnings)
- chat-module.js: getFreshCaptchaToken returns null (not throws) when HCAPTCHA_SITE_KEY is falsy
- chat-module.js: fetchChatStream omits captchaToken from body when null so server bypass fires correctly
feat: add hCaptcha test keys for local development
Use official hCaptcha test keypair (https://docs.hcaptcha.com/#integration-testing-test-keys)
in appsettings.Development.json so all devs get working captcha out of the box without
configuring secrets. Test keys always pass silently no challenge is shown.
- SiteKey: 10000000-ffff-ffff-ffff-000000000001
- SecretKey: 0x0000000000000000000000000000000000000000
These are public constants from hCaptcha docs; committing them is intentional and safe.
Production keys must be set via 'aspire secret set' and will override these defaults.
fix: remove unsafe captcha bypass
Now that appsettings.Development.json has official hCaptcha test keys,
the 'skip when SiteKey not configured' bypass is both unnecessary and dangerous
a misconfigured production deploy would silently allow all requests.
- ChatController: remove IOptions<CaptchaOptions> injection and SiteKey bypass block
- ChatController: remove try-catch around VerifyAsync (InvalidOperationException from
missing SecretKey should surface as 500, not be silently swallowed with fail-open)
- chat-module.js: remove null-return bypass in getFreshCaptchaToken
- chat-module.js: restore direct captchaToken in fetchChatStream body
If hCaptcha is misconfigured in production:
server: throws InvalidOperationException -> 500 (loud, ops must fix)
client: throws 'Captcha is not configured.' -> shows error to user (not silent)
0 commit comments