我目前在我們的Asp.net應用程序中應用了安全措施,並且必須解決像x-frame-options這樣的一些問題,但在如何添加多個內容安全策略指令方面存在困難。是否可以在Asp.net Web.config中添加多個內容安全策略指令?
我搜索了很多,並沒有找到如何在web.config中添加多個CSP指令的準確解決方案,但只能通過代碼如blog.simontimms.com。
目前這是CSP我:
<httpProtocol>
<customHeaders>
<clear />
<add name="X-Frame-Options" value="ALLOW-FROM http://subdomain.domain.com" />
<add name="Content-Security-Policy" value="frame-ancestors http://subdomain.domain.com" />
</customHeaders>
</httpProtocol>
我的問題是如何在Asp.net web.config中添加多個內容安全策略的指令?我試圖通過以下半冒號分隔配置,但它不工作:(
<add name="Content-Security-Policy" value="frame-ancestors http://subdomain.domain.com; img-src *; " />
更新:
我認爲上面的代碼是用於添加多個指令正確的語法我只錯過'self'
權。之後幀的祖先,導致在運行時,這讓我覺得,這是錯誤的第一錯誤
其他信息:
如果你進行了一些問題,在這裏,你有很多的子域名,你可以把通配符'*'
它想:
<add name="Content-Security-Policy" value="frame-ancestors 'self' http://*.domain.com; img-src *; " />
你怎麼改變它基於資源位置像描述在下面的文章的底部? https://pokeinthe.io/2016/04/09/black-icons-with-svg-and-csp/ – SOReader