# Form Bots and the Authenticity Token

**URL:** <https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736>\
**Category:** Rails\
**Created:** [July 27, 2012, 10:25pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736 "2012-07-27T22:25:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 27, 2012, 10:25pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736/1 "2012-07-27T22:25:35Z")

</div>

How are bots able to create authenticity tokens that are valid? I  
thought  
for sure authenticity tokens would make my forms bullet proof for bots.

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![tomrobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tomrobinson](https://www.ruby-forum.com/u/tomrobinson)\
**Post date:** [July 27, 2012, 10:48pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736/2 "2012-07-27T22:48:23Z")

</div>

from my experience, the best is to use some questions like ‘what date is  
today’ or ‘what color do cranberries have’ .. 🙂

this is absolutely bulletproof

tom

On Jul 27, 2012, at 22:24 , Tom R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

# –

Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

# [www.meinlschmidt.com](http://www.meinlschmidt.com) www.maxwellrender.cz www.lightgems.cz

---

<div class="post-metadata">

**Author:** ![tomrobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tomrobinson](https://www.ruby-forum.com/u/tomrobinson)\
**Post date:** [July 27, 2012, 11:02pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736/3 "2012-07-27T23:02:25Z")

</div>

The authenticity token just ensures that the “agent” (person or bot) who  
submits the form first has to request the form. (right?)

If it’s a public form, a bot is just as capable of requesting the form,  
saving the authenticity token, and submitting it back with the  
authenticity token.

The only real way to guard against bots is Captcha

---

<div class="post-metadata">

**Author:** ![tomrobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tomrobinson](https://www.ruby-forum.com/u/tomrobinson)\
**Post date:** [July 29, 2012, 11:37pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736/4 "2012-07-29T23:37:08Z")

</div>

Yes, but it that case I would expect to see a GET request where they get  
the token before they actually POST the form? If I look in the logs all  
I  
see are these bots posting over and over again with different tokens,  
but  
apparently all legit.

---

<div class="post-metadata">

**Author:** ![tomrobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tomrobinson](https://www.ruby-forum.com/u/tomrobinson)\
**Post date:** [July 29, 2012, 10:48pm UTC](https://www.ruby-forum.com/t/form-bots-and-the-authenticity-token/221736/5 "2012-07-29T22:48:38Z")

</div>

Auth token is based on the current session only, so it prevents user  
from  
submiting a form in the name of another user, but does nothing to check  
if  
he’s a human.
