🛡️ Sentinel: Add Honeypot to Contact Form #51
Reference in New Issue
Block a user
Delete Branch "sentinel-honeypot-fix-4259546573877746528"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🛡️ Sentinel: [Security Enhancement] Add Honeypot to Contact Form
Vulnerability:
Automated bots can spam the contact form, exhausting EmailJS quotas and cluttering the inbox.
Impact:
Fix:
Implemented a "honeypot" field (
website) that is visually hidden from human users but visible to bots scanning the HTML.If a bot fills this field:
Verification:
silently rejects submission when honeypot field is filledinContact.test.tsx.example.com(which is blocked by the app's security logic).PR created automatically by Jules for task 4259546573877746528 started by @ragusa-it
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.
When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.
I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!
For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with
@jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!New to Jules? Learn more at jules.google/docs.
For security, I will only act on instructions from the user who triggered this task.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
7ef5c5f779ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Because
checkRateLimit()runs before the honeypot guard, any submission that accidentally fills the hiddenwebsitefield (e.g., browser/password manager autofill that ignoresautoComplete="off") will still consume the rate‑limit window and return a fake success. That leaves a legitimate user unable to resubmit for the cooldown period even though no email was sent. Consider moving the honeypot check beforecheckRateLimit()or bypassing the limiter whenwebsiteis filled.Useful? React with 👍 / 👎.
Pull request overview
This PR hardens the contact form against bot spam by adding a client-side honeypot field and aligning tests and documentation with the updated security behavior.
Changes:
websitehoneypot field that clears and reports success without sending emails when filled.Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
src/pages/Contact.tsxwebsiteto form state and a honeypot short-circuit inhandleSubmit, and renders a visually/semantically hidden honeypot input.src/pages/__tests__/Contact.test.tsxsrc/pages/Contact.module.css.honeypotstyles to visually hide the honeypot field while keeping it in the DOM..jules/sentinel.mdexample.comin tests and recommends safe alternatives.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Because the honeypot container is rendered with
aria-hidden="true"inContact.tsx,getByLabelText('Website')with default options will not find the input (Testing Library excludes aria-hidden content from accessibility queries), causing this test to fail. To reliably target the honeypot field while keeping it hidden from assistive tech, query it using an option that includes hidden elements (for example, enabling thehiddenflag) or switch to a different selector that does not rely on the accessibility tree (such as a test id or role query that allows hidden elements).Pull request closed