# 02 · sandbox-env **演示**:插件在只含 `math`/`string` 的 `_ENV` 里运行;访问 `os` 失败。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/35-plugin-system/02-sandbox-env .tools/bin/lua54 scripts/test-example.lua examples/35-plugin-system/02-sandbox-env ``` **预期输出**(lua 5.4.9 / macOS arm64): ```text allowed=3 blocked=true ``` **看点**:换 `_ENV` 是沙箱第一步,不是全部。 **注意**:白名单别放 `load`/`require`/`debug`/`package`。