【发布时间】:2020-01-06 11:03:59
【问题描述】:
我的项目有 ExtJs 作为前端,Spring boot 作为后端。 ExtJs 将调用 spring boot 以响应 JSON。我想在我的项目中防止clickjacking 攻击。我有一个简单的 html 脚本,它只会在 iframe 中加载网站。如果网站在 iframe 中加载,则意味着它不安全。我在 spring boot REST API 响应中添加了以下标志 X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none'; 以防止那。但即便如此,它也不会阻止我的应用程序在iframe 中加载。检查点击劫持是否可能的代码是
<html>
<head>
<title>Clickjack test page</title>
</head>
<body>
<p>Website is vulnerable to clickjacking!</p>
<iframe src="http://localhost:8000" width="1000" height="1000"></iframe>
</body>
</html>
`
这里,localhost:8000 指的是 extjs URL。我研究并发现防止点击劫持的客户端验证不是那么有效。那么在我的项目中是否有任何选项可以防止点击劫持攻击
【问题讨论】:
-
你能得到 X-Frame-options: DENY 作为响应头表单 API
-
是的,
X-Frame-Options: DENY在响应头字段中
标签: javascript spring-boot extjs spring-security clickjacking