0
我有一个webapp(myApp--使用springBoot和VAADIN开发)。 该webapp将部署在tomcats服务器http://tomcatserver:8080/myApp上。iFrame中webapp的内容安全策略
现在我想展示一个webapp。
现在有一个要求,即IFRAME应该只适用于实现IFRAME的域的白名单。 所以我有一个网络服务器http://myWebserver:8081它有一个index.html里面的IFRAME。
webapp的生成春天的WebSecurityConfigureAdapter如下:
http.csrf().disable(); // Requirement: DTEUTARIF-111
http.headers()
.frameOptions().disable()
.and()
.headers().contentTypeOptions()
.and()
.xssProtection()
.and()
.httpStrictTransportSecurity()
.and()
.addHeaderWriter(
new StaticHeadersWriter(
"Content-Security-Policy",
"default-src 'self';" +
"child-src 'self' http://myWebserver:8081;" +
"script-src 'self' http://myWebserver:8081;" +
"style-src 'self' http://myWebserver:8081;" +
"connect-src 'self' http://myWebserver:8081;" +
"font-src 'self' http://myWebserver:8081;" +
"object-src 'self' http://myWebserver:8081;"
)
);
但我总是得到
angular.js:3543 Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' http://myWebserver:8081". Either the 'unsafe-inline' keyword, a hash ('sha256-1PxuDsPyGK6n+LZsMv0gG4lMX3i3XigG6h0CzPIjwrE='), or a nonce ('nonce-...') is required to enable inline execution.
与同为 '脚本src' 中。
我不知道到100%,但是当我添加'unsafe-inline'
到脚本SRC和风格-SRC的IFRAME是开放的每一个领域。
我该怎么做?反正有可能吗?