Jquery Validate 可以被绕过吗?
自从 Jquery validate 出现以来,我一直是它的忠实粉丝,但我担心用户可能会找到一种方法来绕过它(因为它都是客户端)并将错误数据传递到我的表单。为了确定起见,我总是在字段通过验证后对其进行详尽的验证。但是有谁知道绕过验证的具体方法,我可能会对其进行编程?
I have been a huge fan of Jquery validate since it came out but I am concerned that a user might find a way to bypass it (since it is all client-side) and pass bad data to my forms. I always do an exhaustive job of fields validation AFTER they get through validate, just to be sure. But does anyone know of specific ways to bypass validate that I might program against?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
绕过 javascript 验证的最简单方法:关闭浏览器中的 javascript。
验证服务器端不是“额外”部分,它应该是验证的基础并且能够独立存在,而客户端验证是“额外”部分。
The simplest way to bypass javascript validation: turn off javascript in the browser.
Validating server side is not an "extra", it should be the base of your validation and be able to stand on it's own, with the client side validation being the "extra" part.
任何人(具有一定的编程背景)都可以伪造 HTTP 请求,这意味着可以轻松绕过 JavaScript 验证。因此,您绝对应该验证服务器上的数据。你永远不应该依赖 JavaScript 验证。甚至还有一种更简单的方法可以绕过它:在浏览器中禁用 javascript,然后您就可以向服务器发送您想要的任何内容。使用 javascript 验证仅是为了改善用户体验并节省带宽,但绝不能保证服务器上的数据有效。因此,如果您有一个地方可以执行验证,那就是服务器。
Anyone (with some programming background) could forge an HTTP request meaning that javascript validation could be bypassed easily. For this reason you should absolutely validate data on the server. You should never rely on javascript validation. There's even a simpler way to bypas it: disable javascript in your browser and you will be able to send whatever you want to the server. Use javascript validation only to improve user experience and save bandwidth but never as something that guarantees you valid data on the server. So if you had one single place to perform validation that would be the server.
客户端验证的最大问题是“无 Javascript”选项。
您只需禁用 Javascript,所有验证功能都会验证任何内容。
客户端验证只是为了防止用户必须将表单多次发送到服务器。
您必须检查服务器上的所有表单,否则您将遇到填写错误的表单的麻烦。
The great Problem of Client Side validation is the option "no Javascript".
You just have to Disable Javascript and all your validation functions would validate anything.
The Clientside validation ist just for prevent the User have to send the Form more then once to the server.
You have to check all your forms on the Server otherwise you are running in trouble with malfilled Forms.