Rails 中的 XSS JSON

发布于 12-14 00:19 字数 133 浏览 2 评论 0原文

我正在 Rails 中使用 Backbone 渲染内容。我从模型中获取的一些 json 属性将是 html 属性,其中一些可能在 javascript 中使用,而其他属性将插入到 html 元素之间。所有这些都需要不同的转义机制,人们如何处理这个问题?

I'm rendering content using Backbone in Rails. Some of the json properties i'm getting from the models will be html attributes, some of them might be used inside the javascript and others will be inserted between html elements. All of these require different escaping mechanisms, how do people deal with this?

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

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