我在Heroku上发布了一个django博客应用程序,目前一切正常,但我有一个关于Missing Subresource Integrity Protection
的小问题。在
我对使用heroku插件很陌生,但是我已经设置了tinfoil来保证安全性,在初始扫描之后,我遇到了3个漏洞。扫描结果表明我是Missing Subresource Integrity Protection
,他们建议我:
> All externally loaded resources must have their content pinned using
> the subresource integrity mechanisms provided by modern browsers. This
> involves computing a hash of the contents of the resource, and
> specifying this hash when loading that resource. In the case of a
> script, this might look like the following:
<script src="https://example.com/include.js"
integrity="sha256-Rj/9XDU7F6pNSX8yBddiCIIS+XKDTtdq0//No0MH0AE="
crossorigin="anonymous"></script>
SRI Hash is an option for computing the necessary hashes.
有人能给我解释一下这一切意味着什么吗?这样我就可以从中学到一些东西,以及将来该怎么做才能避免这种情况吗?在
Subresource integrity是一个规范,它“定义了一种机制,用户代理可以通过该机制来验证获取的资源是否已在没有意外操作的情况下传递。”它基本上是资产的校验和,如果资源与指定的完整性值不匹配,兼容浏览器将不会加载该资源。在
这很容易添加到Rails中,只要您的链轮版本是3.x或更高版本。您可以按照sprockets documentation中的示例添加检查:
GitHub Engineering有一个interesting blog post,他们在那里详细讨论了这个特性。在
相关问题 更多 >
编程相关推荐