From 77ad3738855e02f0dbb6c49f29101bb487643edb Mon Sep 17 00:00:00 2001 From: thethreemagi Date: Tue, 1 Sep 2026 13:17:08 -0400 Subject: [PATCH] join: honeypot field + server-side validation on POST /join Three bot submissions landed 2026-08-30 with both selects carrying the placeholder label "Select one..." - required= is browser-only and a direct POST skips it. Adds a hidden honeypot (answers 303 so the bot sees success) and server-side checks on name, email, children, interested_in and source. Rejections are logged with the client IP and never touch any store. --- app/app.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/app/app.py b/app/app.py index 904e9bc..d1c02f3 100644 --- a/app/app.py +++ b/app/app.py @@ -1,6 +1,6 @@ -import json, os, time, datetime, urllib.request, urllib.parse +import json, os, re, time, datetime, urllib.request, urllib.parse from pathlib import Path -from fastapi import FastAPI, Form +from fastapi import FastAPI, Form, Request from fastapi.responses import FileResponse, HTMLResponse, RedirectResponse from fastapi.staticfiles import StaticFiles @@ -634,7 +634,10 @@ def thanks_body(): """ -def join_body(): +def join_body(error=""): + err_html = ( + '
' + + error + "
") if error else "" faq_html = "".join(f'
{q}
{a}
' for q, a in FAQ) return f"""
@@ -649,7 +652,8 @@ def join_body(): Scouts cheering during a pack game
-
Interest form
+
Interest form
{err_html} +
@@ -747,10 +751,58 @@ def pipeline_notify(rec, sheet_error=None): except Exception: return False +# --- form integrity -------------------------------------------------------- +# 2026-08-30: three bot submissions landed with both