Repository navigation
Aakash - Jobs Component: honeypot, fill time and optional Turnstile on submit (Bug 61) - #5675
Open
vidiyala99 wants to merge 4 commits into
Open
vidiyala99 wants to merge 4 commits into
vidiyala99 wants to merge 4 commits into
Conversation
…e to public submit Sends website_url (empty), fillMs and, when VITE_TURNSTILE_SITE_KEY is set, cf-turnstile-response. Shows the server message on 429 and on a failed verification.
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
rahulrubugunday
previously approved these changes
Oct 24, 2026
rahulrubugunday
left a comment
There was a problem hiding this comment.
I have reviewed your PR locally (f2c7a2b, backend on HGNRest #2414 12884f73) and it works as per requirement.
- The submit request sends an empty website_url and a numeric fillMs (e.g. 140656).
- The honeypot field is hidden from people (off-screen, aria-hidden, tabindex -1, autocomplete off).
- When the server rate-limits the submit, the red "Too many applications from this connection. Please try again later." message shows under the form instead of a success toast, readable in both light and dark mode.
- No Turnstile widget shows when no site key is set.
- The JobApplicationForm tests pass (13 files, 135 tests).
|
This branch has not been deployed
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.



Description
Bug 61 (Jobs Component - Bot Protection and Rate Limiting on Submit), frontend half. The public job application form now sends the signals the new backend checks use (a hidden honeypot field and how long the form was open), can show a Cloudflare Turnstile widget when maintainers configure one, and shows a clear message when the server rate-limits or rejects the submit.
Fixes # Bug 61 (Jobs Component - Bot Protection and Rate Limiting on Submit)
Original task:
Feature / Page: /job-application and /apply/:slug submit
Issue: The public application route has no captcha, no rate limit, and no honeypot, so a script can submit unlimited fake applications (each one also sends an email, see Update Dashboard.jsx #62).
Expected Behavior: A per-IP rate limit on the submit route, a hidden honeypot field, and Cloudflare Turnstile (free) if the API sits behind Cloudflare. Real applicants see no extra steps beyond the Turnstile check.
Note: Needs an admin to confirm whether the API host is behind Cloudflare and to provide a Turnstile site key. Menu Unresponsive Mobile View #58 (Purav) touches the same submit route; coordinate with its assignee.
Related PRS (if any):
HGNRest#2414 (the backend half: per-IP and per-email limits, honeypot and fill-time check, optional Turnstile check). This PR works before or after it: the backend ignores the extra fields until it is deployed, and a missing
fillMsis allowed there.Main changes explained:
JobApplicationForm.jsx: add a hidden text inputwebsite_url(off-screen through a CSS module class,tabIndex={-1},autoComplete="off", wrapperaria-hidden, no label) that is sent empty; real people cannot reach it by keyboard or screen reader. SendfillMs, the milliseconds the form was open before submit.turnstile.jsandTurnstileWidget.jsx: the Turnstile script loads and the widget renders only whenVITE_TURNSTILE_SITE_KEYis set at build time; the token is sent ascf-turnstile-responseand the widget resets after a failed submit (tokens are single use). The widget theme follows dark mode. No new npm dependency. Without the key the form is unchanged: no script, no widget, no extra field.429shows the server's message (fallback "Too many applications from this connection. Please try again later."), and a400"Verification failed. Please try again." shows that text. Both use the existing.fieldErrorstyle withrole="alert"above the submit button and clear on the next submit. Other errors (409 and the rest) behave as before.JobApplicationForm.module.css:.honeypotclass.JobApplicationForm.botProtection.test.jsx(10 tests): honeypot is hidden from keyboard and screen readers and sent empty,fillMsis a number, widget and script absent without the key and present once with it, token sent, widget reset after a 400, 429 message and fallback, message clears on resubmit.How to test:
npm installnpx vitest run src/components/Collaboration(110 tests pass)website_urlempty and a numericfillMs.VITE_TURNSTILE_SITE_KEY(Cloudflare provides a public test key) in.env.local; the widget appears above the submit button.Screenshots or videos of changes:
The real form with a mocked backend reply. Too many applications from one connection (light, desktop):
Too many applications for one email address (dark, phone):
Failed verification (dark, desktop):
Note:
VITE_TURNSTILE_SITE_KEYis optional and never committed. Maintainers create the Turnstile widget and set the matchingTURNSTILE_SECRET_KEYon the backend.window.turnstile.Retry-Afteris not read; the message is the server's text only.