Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Simple bot protection that should elimiminate most of the spam on our forms #3350

Merged
merged 5 commits into from
May 14, 2024

Conversation

istarkov
Copy link
Member

@istarkov istarkov commented May 13, 2024

Description

Add simple protection against non js and jsdom bots

Idea is to add hidden js generated field on submit, and check that matchMedia is working.

Steps for reproduction

Go here
https://saas-form-rdlrc.wstd.work/

then check via curl

curl 'https://saas-form-rdlrc.wstd.work/?index=&_data=routes%2F_index' \
  -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' \
  -H 'referer: https://saas-form-rdlrc.wstd.work/' \
  --data-raw 'ws--form-id=2TIgyB2vQViDMitiYiGSK&name=wewe&email=wewe&ws--form-bot=18f72a6'

curl 'https://saas-form-rdlrc.wstd.work/?index=&_data=routes%2F_index' \
  -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' \
  -H 'referer: https://saas-form-rdlrc.wstd.work/' \
  --data-raw 'ws--form-id=2TIgyB2vQViDMitiYiGSK&name=wewe&email=wewe'

curl 'https://saas-form-rdlrc.wstd.work/?index=&_data=routes%2F_index' \
  -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' \
  -H 'referer: https://saas-form-rdlrc.wstd.work/' \
  --data-raw 'ws--form-id=2TIgyB2vQViDMitiYiGSK&name=wewe&email=wewe&ws--form-bot=jsdom'

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 5de6)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env.example and the builder/env-check.js if mandatory

@istarkov istarkov requested a review from kof May 13, 2024 15:37
@kof kof changed the title experimental: Simple bot protection experimental: Simple bot protection that should elimiminate most of the spam on our forms May 14, 2024
@istarkov istarkov changed the title experimental: Simple bot protection that should elimiminate most of the spam on our forms feat: Simple bot protection that should elimiminate most of the spam on our forms May 14, 2024
@istarkov istarkov merged commit 8cdc103 into main May 14, 2024
35 of 37 checks passed
@istarkov istarkov deleted the simple-bot.staging branch May 14, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants