安全的 ECMAScript

如果无法正常显示,请先停止浏览器的去广告插件。
分享至:
1. Secure ECMAScript Jack Works Sujitech 前端工程师
2. • 供应链攻击 • 基于对象能力(Object Capability)的安全模型 • 沙盒、Realm 的概念和 Realm 提案 • Membrane 和 Compartment 提案
3. 用途 • 第三方插件系统 • 微前端 • 敏感代码
4.
5. 供应链攻击 安装时、编译时攻击 运行时攻击
6.
7. 基于角色的安全模型 • 执行这项操作的主体是谁? • 它有权限执行这项操作吗?
8. 解决办法? 1. 不使用任何第三方依赖? 2. 对整个依赖树进行安全审计? 3. ……
9. 解决办法? 1. 不使用任何第三方依赖? 2. 对整个依赖树进行安全审计? 3. 基于对象能力(Object Capabilities)的安全模型 + 沙盒
10. 基于对象能力 (Object capability) 的安全 模型
11. 基于角色 • 执行这项操作的主体是谁? • 它有权限执行这项操作吗? 基于对象能力 • 它有执行这项操作的钥匙吗?
12. 权限衰减 (attenuation) b a c d
13. 基于对象能力的安全模型的前提 1. 引用不可伪造(内存安全) 2. 不能访问私有属性和方法 3. 副作用不能从语法直接构造 4. 只能通过拥有的对象执行副作用
14. Linux x86_64, clang-7 1. 2. 3. 4. ✔ 引用不可伪造(内存安全) ❔ 不能访问私有属性和方法 ❔ 副作用不能从语法直接构造 ❔ 只能通过拥有的对象执行副作用
15. 1. 2. 3. 4. ✔ 引用不可伪造(内存安全) ✔ 不能访问私有属性和方法 ❔ 副作用不能从语法直接构造 ❔ 只能通过拥有的对象执行副作用
16. 1. 2. 3. 4. ✔ 引用不可伪造(内存安全) ✔ 不能访问私有属性和方法 ❌ 副作用不能从语法直接构造 ❔ 只能通过拥有的对象执行副作用
17. ES5:严格模式
18. 1. 2. 3. 4. ✔ 引用不可伪造(内存安全) ✔ 不能访问私有属性和方法 ✔ 副作用不能从语法直接构造 ❌ 只能通过拥有的对象执行副作用
19. ECMAScript 中基于对象能力的前提 1. ✔ 引用不可伪造(内存安全) 2. ✔ 不能访问私有属性和方法 3. ✔ 副作用不能从语法直接构造(严格模式) 4. ❌ 只能通过拥有的对象执行副作用
20. 历史的巧合
21.
22.
23. 拦截全局对象查找
24. 今天的沙盒
25. 今天的沙盒
26. globalThis Object Function Object.prototype Function.prototype 规范中的 Realm Global eval Array document Array.prototype
27. 身份不连续 (Identity discontinuity)
28. 身份不连续 (Identity discontinuity) Object Function Function.prototype Function Global Object Object.prototype Array.prototype Array document Global Function.prototype eval Array iframe.contentWindow arr document eval Object.prototype Array.prototype
29. Realm 提案 (旧版) https://github.com/tc39/proposal-realms/
30.
31. Object Function Object Object.prototype Function Function.prototype Object.prototype Function.prototype Global Global Array Array.prototype Array Array.prototype dangerous.js fetch fetch (fake) r = new Realm() 沙盒逃逸
32. Membrane Function fetch idb Proxy Proxy fetch idb
33. Membrane Function fetch idb Proxy Proxy fetch idb
34. SES Meeting: Building Membranes in JavaScript, 2021 年 1 月
35.
36.
37. 旧版 Realm 提案
38. Isolated Realm
39.
40. Compartment 提案 • https://github.com/tc39/proposal-compartments • 冻结并共享内置对象 • 更进一步的虚拟化
41.
42. 虚拟化
43.
44. 展望 • Realms 提案 • Compartments 提案 • 🚧 https://github.com/endojs/endo 安装、编译时防护 • 🚧 https://npmjs.com/ses 运行时防护
45.

trang chủ - Wiki
Copyright © 2011-2024 iteam. Current version is 2.132.1. UTC+08:00, 2024-09-23 19:28
浙ICP备14020137号-1 $bản đồ khách truy cập$