Commit 77e1427
feat: enhance contact form spam detection with better pattern matching (#909)
* Improve spam detection for contact forms
Enhanced the isLikelySpam function to better catch randomized spam submissions:
- Count both uppercase→lowercase and lowercase→uppercase transitions (not just one direction)
- Detect suspicious uppercase ratios (30-95%) that indicate random character strings
- Allow all-uppercase (JOHN SMITH, IBM) and all-lowercase (john smith) as legitimate
- Flag strings with 4+ case transitions OR uppercase ratio in suspicious range
This catches spam like "CuxFbsjOMshzd", "lxBMWgpkbCX", "cVBaaQcPphWeXH" while allowing legitimate names like "McDonald", "iPhone", or all-caps company names.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Replace spam prefix with 🙄 emoji
More concise and expressive than "[POTENTIAL SPAM]" text.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent f6a1bc2 commit 77e1427
2 files changed
+32
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
69 | 93 | | |
70 | 94 | | |
71 | 95 | | |
| |||
158 | 182 | | |
159 | 183 | | |
160 | 184 | | |
161 | | - | |
| 185 | + | |
162 | 186 | | |
163 | 187 | | |
164 | 188 | | |
| |||
0 commit comments