feat: integrate Cloudflare Turnstile for Captcha validation#44
Merged
Conversation
…com for frame and script sources
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.
Overview
This pull request introduces Cloudflare Turnstile as an additional CAPTCHA provider, offering a user-friendly alternative to hCaptcha. The integration includes necessary environment variable schemas, frontend exposure of site keys, and critical security header updates to allow Cloudflare's assets to load correctly.
Key Changes
Security & Headers
Updated the
helmet.jsmiddleware configuration in both the API and Web apps. To prevent Content Security Policy (CSP) violations, the following directives now includehttps://challenges.cloudflare.com:frame-srcscript-srcconnect-srcConfiguration & Environment
CLOUDFLARE_TURNSTILE_SITE_KEYandCLOUDFLARE_TURNSTILE_SECRET_KEYto all.envexamples and validation schemas.CLOUDFLARE_TURNSTILE_SITE_KEYis now passed to the frontend through theMETAobject in the home route, enabling the client-side widget to initialize.API & Docs
handleGenerateDocxfunction now receives the fullrequestobject, allowing for more robust validation (e.g., checking CAPTCHA tokens directly within the handler).openai-wrapperandvm-runnerto align with recent source code shifts.How to Test
.envfile.generate-docxrequest to proceed.Screenshots/Video
(N/A - Backend and configuration logic)