<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>能力授权 on PlumePHP</title><link>https://plumephp.com/tags/%E8%83%BD%E5%8A%9B%E6%8E%88%E6%9D%83/</link><description>Recent content in 能力授权 on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Mon, 28 Sep 2026 13:00:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/%E8%83%BD%E5%8A%9B%E6%8E%88%E6%9D%83/index.xml" rel="self" type="application/rss+xml"/><item><title>WASI 文件系统与沙箱：preopened 目录、能力模型与路径逃逸防护</title><link>https://plumephp.com/wasm-wasi-filesystem-sandbox/</link><pubDate>Mon, 28 Sep 2026 13:00:00 +0800</pubDate><guid>https://plumephp.com/wasm-wasi-filesystem-sandbox/</guid><description>&lt;h2 id="引言"&gt;引言&lt;/h2&gt;
&lt;p&gt;WASI 最反直觉的一点：&lt;strong&gt;WASM 模块默认什么文件都碰不到&lt;/strong&gt;。没有「工作目录」「当前用户文件」，甚至没有 &lt;code&gt;/&lt;/code&gt;——它看到的文件系统完全是宿主「显式打开」的那几扇窗。这套 &lt;strong&gt;能力（capability）模型&lt;/strong&gt; 与 OS 的 &lt;code&gt;chroot&lt;/code&gt;、容器的挂载卷有本质区别：它不是「把整个文件系统藏起来一部分」，而是「根本没给文件系统，只给能力凭证」。本文把 WASI 文件系统沙箱的机制拆开：preopened directories 是什么、fd 与 path_open 的能力链怎么走、路径解析如何杜绝 &lt;code&gt;..&lt;/code&gt; 与符号链接逃逸、权限标志怎么配、以及多租户场景的正确姿势。&lt;/p&gt;</description></item></channel></rss>