From 1d5596db5f5b2ae826a469344518d627b3c95e3f Mon Sep 17 00:00:00 2001 From: Artemii Peretiachenko Date: Sun, 26 Jul 2026 19:16:36 +0200 Subject: [PATCH] Fix contact honeypot so browser autofill does not swallow submissions. Rename the trap field away from "website" and keep legacy detection so real messages still reach Telegram. Co-authored-by: Cursor --- api/README.md | 2 +- api/contact_server.py | 8 +++++--- en/index.html | 4 ++-- en/terminal/index.html | 4 ++-- index.html | 4 ++-- src/index.html | 4 ++-- src/terminal.html | 4 ++-- styles.css | 14 ++++++++++++-- terminal/index.html | 4 ++-- ua/index.html | 4 ++-- ua/terminal/index.html | 4 ++-- 11 files changed, 34 insertions(+), 22 deletions(-) diff --git a/api/README.md b/api/README.md index 5d7ba4f..98a675c 100644 --- a/api/README.md +++ b/api/README.md @@ -104,6 +104,6 @@ Backup is written even if Telegram fails (`telegram_ok: false`), so you still ha ## Behaviour notes -- Honeypot field `website`: if filled, returns `200` without notifying Telegram or writing a backup. +- Honeypot field `hp_company` (legacy `website` still checked): if filled, returns `200` without notifying Telegram or writing a backup. - In-memory rate limit: 5 POSTs per IP per 60 seconds → `429`. - Field limits: name/contact ≤ 200 chars, message ≤ 4000. diff --git a/api/contact_server.py b/api/contact_server.py index b61c10f..80fbf80 100644 --- a/api/contact_server.py +++ b/api/contact_server.py @@ -114,9 +114,11 @@ def validate_fields(data: dict) -> tuple[str, str, str] | str: return "invalid" # Honeypot — treat as success upstream; caller checks separately. - website = data.get("website", "") - if isinstance(website, str) and website.strip(): - return "honeypot" + # Accept legacy "website" (autofill magnets) and current "hp_company". + for pot in ("hp_company", "website"): + raw_pot = data.get(pot, "") + if isinstance(raw_pot, str) and raw_pot.strip(): + return "honeypot" def field(key: str, max_len: int) -> str | None: raw = data.get(key, "") diff --git a/en/index.html b/en/index.html index cbdddb3..900161b 100644 --- a/en/index.html +++ b/en/index.html @@ -429,8 +429,8 @@