Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails state of the art for spam prevention

What is the current state of the art in rails for preventing spam accounts? Captcha? Any good plugins, tutorials or suggestions?

like image 541
srboisvert Avatar asked Dec 22 '22 14:12

srboisvert


1 Answers

Use a library: You're (almost) always better off appropriating code from people who are better at the subdomain than you are. The Wordpress guys behind Akismet have forgotten more about blog spam than I know, and I was an email anti-spam researcher for a while. You might be interested in a Rails integration plugin for Akismet.

Defense in Diversity: Spam is a quirky problem, in that the more popular a countermeasure gets the worse it becomes. As such, particularly for low-profile sites, you can get disgustingly good results by coding simple one-off tripwires. I won't give you any code to copy/paste because it defeats the purpose of the excercize: having a countermeasure which is globally unique.

One simple example is having a hidden form element which starts as some randomized string, and which is set to a known good value by Javascript code. You then bounce anything which doesn't have the good value supplied. This blocks clients which don't implement Javascript, which includes the overwhelming majority of spam scripts. There are issues, of course, as some legitimate clients also block Javascript -- but realistically, if you're using Rails, I'm guessing you're sort of assuming cookies are on and Javascript works.

like image 69
Patrick McKenzie Avatar answered Dec 31 '22 13:12

Patrick McKenzie