安全与隐私hacks.mozilla.org
别让 CDN 背叛你:使用子资源完整性
Do not let your CDN betray you: Use Subresource Integrity
2015 — 2017,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Mozilla Hacks 的这篇文章介绍 Firefox 43 开始支持的子资源完整性(SRI):通过在 <script>/<link> 标签上附加内容哈希,让浏览器校验来自 CDN 或其他第三方来源的 JS/CSS 是否被篡改,防止 CDN 被入侵或劫持后向用户注入恶意代码。文章还说明了使用前提(CDN 需支持 CORS)等细节。
为什么经久不衰:第三方脚本供应链攻击至今仍是真实威胁,SRI 是低成本高收益的防御手段,这篇文章仍是最好的入门讲解之一。
HN 评论精选
SRI 不仅防攻击,还能防止第三方悄悄变更导致网站损坏
SRI 除了防范第三方脚本的安全问题,还带来稳定性收益:你不用担心 src 属性另一端的人(哪怕出于好意)悄悄改动内容搞坏你的网站。这是纯粹的赢,希望所有浏览器尽快支持。
dccoolgai查看英文原文
One thing about SRI that's also great - even beyond the security concerns with 3rd party scripts - is the benefit of stability. You know whoever controls the other end of the src attribute on your 3rd party <script> tag won't go changing things (even with the best of intentions) quietly that break your site. It's an out-and-out win and I hope all browsers support it soon.
用 webpack 插件可以零成本启用 SRI,跨域加载资源时尤其有用
如果你用 webpack,只需加上 webpack-subresource-integrity 插件,就能几乎“免费”地为所有脚本生成 SRI 标签。如果静态资源和 HTML 同源部署且始终走 HTTPS,SRI 用处不大;但 JS/CSS 从别的服务器加载时它仍能提供保护。
Klathmon查看英文原文
If you use webpack, just drop in webpack-subresource-integrity [0] for basically "free" SRI tags on all scripts. It's not really as useful if you are serving your static assets from the same place as the HTML (and you always use HTTPS) but if you load your js/css on another server SRI can still provide some protection. [0] https://github.com/waysact/webpack-subresource-integrity
所有第三方脚本(支付、广告、统计)都值得加 SRI
不只是 CDN,对很多第三方引入 SRI 都有好处:Stripe 的 JS、吓人的广告网络 JS、前端分析公司。SRI 能保护你免受这些众多第三方被攻破的波及。
ejcx查看英文原文
Not just CDN, there's benefits to rolling out SRI for lots of your third parties. Your stripe js, scary ad networks js, front-end analytics companies. SRI is really neat and helps protect yourself from these many 3rd parties being pwned.
质疑 CDN 不支持 CORS 时 SRI 的降级行为是否安全
要让 SRI 生效,CDN 必须支持 CORS。如果 CDN 不支持 CORS 而浏览器支持 SRI,那么 SRI 是被忽略(糟糕,因为攻击者可以先禁用 CORS 再改 JS),还是被强制执行从而拒绝运行该 JS(好)?
riquito查看英文原文
> An important side note is that for Subresource Integrity to work, the CDN must support Cross-Origin Resource Sharing (CORS). If the CDN doesn't support CORS and the browser does support subresource integrity, subresource integrity is ignored (bad, since an attacker can disable CORS before changing the js) or enforced, thus refusing to execute the js (good)?
历次讨论
同类还值得读
非法素数
Illegal prime
维基百科条目,介绍“非法素数”:某些素数之所以被称为“非法”,是因为它们经特定编码后,恰好对应一段被法律禁止传播的数据——最著名的是 DVD 解密程序 DeCSS 的代码,有人把…
安全与隐私上首页 5 次 · 2010–2021en.wikipedia.org编辑精选关于 /dev/urandom 的常见误区
Myths about /dev/urandom
(Thomas Hühn 撰写,2014 年首发并持续更新)逐条反驳关于 /dev/urandom 的常见误解:它与 /dev/random 使用的是同一个 CSPRNG,一旦完…
安全与隐私上首页 5 次 · 2014–20202uo.de编辑精选AES 高级加密标准火柴人图解
A Stick Figure Guide to the Advanced Encryption Standard (AES)
一篇用火柴人漫画形式讲解 AES(高级加密标准)算法的经典科普文章。
安全与隐私上首页 5 次 · 2009–2022moserware.com编辑精选指纹是用户名,不是密码
Fingerprints are Usernames, not Passwords
作者(eCryptfs 维护者、Ubuntu 安全工程师)认为指纹等生物特征是公开、不可更改的标识,应视作用户名而非密码,不能当作秘密凭据用于认证。
安全与隐私上首页 4 次 · 2013–2017blog.dustinkirkland.comHTTPS 连接的最初几毫秒(2009)
The First Few Milliseconds of an HTTPS Connection (2009)
逐毫秒拆解一次 HTTPS 连接建立时发生了什么,重点讲 TLS 握手、证书验证、RSA 签名与密钥协商等机制,面向不熟悉该领域的读者。
安全与隐私上首页 4 次 · 2009–2020moserware.com编辑精选