内容在代码HTML标签XSS容易受到攻击? [英] Is content within code HTML tags XSS vulnerable?

查看:893
本文介绍了内容在代码HTML标签XSS容易受到攻击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Codeingiter,我看到 xss_clean()正在用一个空格字符替换制表符。这会破坏稍后在< pre>< code>< / code>< / pre> 标签中显示的内容。

I am using Codeingiter, I see that the xss_clean() is replacing the tab characters with a single space character. This is breaking the contents that are later displayed inside <pre><code></code></pre> tags.

可以在< code> HTML标签中的XSS攻击字符串有什么问题吗?

Can XSS attack string inside <code> HTML tag be of any problem?

如果是,在这种情况下是否有办法保留选项卡?

If yes, is there a way to retain the tabs in such a situation?

推荐答案

是的,< code> 元素中的XSS攻击仍然是一个问题。为了解决这个问题,你应该在< code> 块中转义你的代码。例如

Yes, XSS attacks within the <code> element are still a problem. To get around this, you should escape your code within the <code> block. e.g.

<pre><code>&lt;p%gt;this is an example paragraph in code&lt;/p&gt;</code></pre>

这将显示为:

<p>this is an example paragraph in code</p>

这篇关于内容在代码HTML标签XSS容易受到攻击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆