可见的正则是输入元素中的“ live”验证

发布于 2025-01-26 19:10:30 字数 399 浏览 5 评论 0原文

因此,我正在考虑可能发生的安全问题,因为我的设置以下设置可能会发生:

我在文本输入字段的数据零件中写下正则代码。并且在键入时,我正在用jQuery验证对正则的用户输入。

我的安全性想法是:我是否在验证任何用户可以通过浏览器的开发人员工具进行验证时(从技术上讲)操纵的正则漏洞时,我是否打开了安全孔?

这就是我的输入的样子:

<input id="email-regex-asd" type="text" data-regex="/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/">

编辑: 只是为了清楚地表明:我仍在验证后端中的完整用户输入,以防止SQL注入,交叉分解等。

so i am thinking about possible security-problems, that could occur because of my following setup:

I write the regex-code in a data-part of a text-input field. And while typing i am validating the user-input against the regex with jquery.

My security-thoughts are: Am i opening security holes while validating regex-code that could (technically) be manipulated by any user via, for example, the developer-tools of a browser?

This is how my input looks like:

<input id="email-regex-asd" type="text" data-regex="/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/">

Edit:
Just to make it clear: I am still validating the complete user-input in the backend to prevent SQL-injection, crossite-scripting, etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心在旅行 2025-02-02 19:10:30

对提供的示例没有安全关注。

比较是与前端&amp;后端验证与仅后端的验证。如果具有前端验证会提高良好和/或性能,那么对您来说会有更多的力量。

No security concern with the example provided.

The comparison is an application with front-end & back-end validation vs one with just back-end. If having the front-end validation improves nicety and/or performance, more power to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文