2

I've already read most of the questions regarding techniques to prevent form spam, but none of them seem to suggest the use of the browser's session.

We have a form that sends an email to given email address and we didn't like the idea of using "captchas" or Javascript, as we wanted to keep the user journey simple and accessible to those without Javascript.

We would like to use the session object to help prevent form spam. Our webapp is developed on Weblogic Server 10 using Struts.

The solution being, when the form loads, it would set a variable in the session object. Once you click submit, we check if the session for the variable. No variable, redirect to the form. Variable exists send the email.

I would really appreciate any opinions/reasons why this might be a bad idea, so we can evaluate this solution against others.

Many thanks, Jonathan

4

4 回答 4

1

没有什么可以阻止垃圾邮件发送者自动下载您的表单(从而生成 cookie)并提交它。它可能会给垃圾邮件发送者带来轻微的负担,但微不足道。

例如,可以使用命令行工具(例如 cURL)轻松下载和提交表单,并保留 cookie。然后可以从脚本重复运行。

于 2009-05-05T17:03:46.763 回答
0

根据实现的不同,会话对象在资源使用方面可能相对较重,而且速度有些慢。此外,垃圾邮件发送者,如果他们意识到您是如何阻止他们的,他们可以在每次点击表单时通过不发送回会话 cookie 来简单地启动一个新会话。

因此,由于该技术依赖于客户端的良好行为,并且预期的行为相当容易防止,因此它可能不如其他解决问题的方法有用。

于 2009-05-05T16:25:42.610 回答
0

感谢您的回复 cdeszaq,但我不确定您是否误解了我的问题。

为了成功完成表单提交,客户端将被迫加载表单以正确设置会话对象。只有当会话处于正确状态时,才能发送电子邮件。

如果垃圾邮件发送者没有发回会话 cookie,那么他们将无法向我的表单发送垃圾邮件,因为他们没有进入创建正确会话的表单页面。

我同意使用会话对象会创建额外的资源。我们的实现将简单地(使用 JSP)调用session.setAttribute("formLoaded", true);,并在我的 Struts 操作中简单地用于session.getAttribute("formLoaded");检查。

于 2009-05-05T16:40:18.303 回答
0

我想知道这是否可行:

  1. 每次渲染页面/表单时,创建一个随机的文本位
  2. 将该文本放入会话中
  3. 将该文本作为隐藏字段包含在表单中
  4. 用户提交表单
  5. 操作将隐藏文本与会话中的值进行比较 - 如果匹配,则发送电子邮件

由于黑客无法在会话中添加任何随机值,因此他们无法发送垃圾邮件。正确的?

于 2009-05-05T17:18:39.770 回答