fro*_*dev 5 html javascript xss single-page-application
我正在实现一个所谓的“单页应用程序”,它接受 JSON 作为输入。这也意味着所有 HTML 都在浏览器中呈现,而且所有模板(我使用淘汰赛)似乎都不受用户输入的影响,因为模板不是由后端动态构建的,而是静态嵌入在客户端中的。换句话说,我不做这样的事情:
echo '<input type="text" value="$var">'
Run Code Online (Sandbox Code Playgroud)
所以所有用户内容的渲染本质上都归结为这些 JS 方法:
document.createTextNode(userVar); // for displaying static text
inputElement.value = userVar; // for populating input fields
document.title = userVar; // some user input can be reflected in the doc title
window.history.pushState = ... // no user input is set here directly, but there are URIs where this could be set using an outside link
Run Code Online (Sandbox Code Playgroud)
所以现在的问题是:这些方法都是100% XSS 安全的吗?或者还有什么方法可以触发 XSS 攻击——如果“是”,那怎么做?
归档时间: |
|
查看次数: |
750 次 |
最近记录: |