Skip to content

Commit 9193b7b

Browse files
committed
docs(pluginlab): document new permision flags
1 parent 2adbde7 commit 9193b7b

2 files changed

Lines changed: 38 additions & 6 deletions

File tree

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ The plugins like `ls` or `cat` can interact with the filesystem using the primit
3030
- on the CLI, a folder from the disk is mounted via the `--dir` flag
3131
- on the browser, a virtual filesystem is mounted, the I/O operations are forwarded via the `@bytecodealliance/preview2-shim/filesystem` shim, which shims the `wasi:filesystem` filesystem interface
3232

33+
The CLI host `pluginlab` supports the same kinds of permissions deno introduced:
34+
35+
- `--allow-net`: allows network access to the plugins, you can specify a list of domains comma separated (by default, no network access is allowed)
36+
- `--allow-read`: allows read access to the filesystem
37+
- `--allow-write`: allows write access to the filesystem
38+
- `--allow-all`: allows all permissions (same as all the flags above), short: `-A`
39+
40+
This is what it means by plugins being "sandboxed by default" - you can take any plugin from anywhere, if you don't allow any access, it won't be able to make any network request or read/write to your filesystem and it will be constrained to its own part of the memory.
41+
3342
<p align="center"><a href="https://topheman.github.io/webassembly-component-model-experiments/"><img src="./packages/web-host/public/wasi.png" alt="Demo" /></a></p>
3443
<p align="center">
3544
Check the online demo at<br/><a href="https://topheman.github.io/webassembly-component-model-experiments/">topheman.github.io/webassembly-component-model-experiments</a>
@@ -65,12 +74,17 @@ pluginlab\
6574
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_ls.wasm\
6675
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm\
6776
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm\
68-
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
77+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
78+
--allow-all
6979
```
7080

7181
Other flags:
7282

7383
- `--dir`: directory to be preopened (by default, the current directory)
84+
- `--allow-net`: allows network access to the plugins, you can specify a list of domains comma separated (by default, no network access is allowed)
85+
- `--allow-read`: allows read access to the filesystem
86+
- `--allow-write`: allows write access to the filesystem
87+
- `--allow-all`: allows all permissions (same as all the flags above), short: `-A`
7488
- `--help`: displays manual
7589
- `--debug`: run the host in debug mode (by default, the host runs in release mode)
7690

@@ -83,7 +97,8 @@ pluginlab\
8397
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_ls.wasm\
8498
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm\
8599
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm\
86-
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
100+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
101+
--allow-all
87102
[Host] Starting REPL host...
88103
[Host] Loading REPL logic from: https://topheman.github.io/webassembly-component-model-experiments/plugins/repl_logic_guest.wasm
89104
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_greet.wasm
@@ -167,7 +182,8 @@ This will (see [justfile](./justfile)):
167182
--plugins ./target/wasm32-wasip1/debug/plugin_ls.wasm\
168183
--plugins ./target/wasm32-wasip1/debug/plugin_echo.wasm\
169184
--plugins ./target/wasm32-wasip1/debug/plugin_weather.wasm\
170-
--plugins ./target/wasm32-wasip1/debug/plugin_cat.wasm
185+
--plugins ./target/wasm32-wasip1/debug/plugin_cat.wasm\
186+
--allow-all
171187
```
172188

173189
This will run the `pluginlab` binary which will itself:
@@ -187,7 +203,8 @@ Other example:
187203
--repl-logic ./target/wasm32-wasip1/debug/repl_logic_guest.wasm\
188204
--plugins ./target/wasm32-wasip1/debug/plugin_ls.wasm\
189205
--plugins ./target/wasm32-wasip1/debug/plugin_echo.wasm\
190-
--dir /tmp
206+
--dir /tmp\
207+
--allow-all
191208
```
192209

193210
#### Test

crates/pluginlab/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ The plugins like `ls` or `cat` can interact with the filesystem using the primit
2525
- on the CLI, a folder from the disk is mounted via the `--dir` flag
2626
- on the browser, a virtual filesystem is mounted, the I/O operations are forwarded via the `@bytecodealliance/preview2-shim/filesystem` shim, which shims the `wasi:filesystem` filesystem interface
2727

28+
The CLI host `pluginlab` supports the same kinds of permissions deno introduced:
29+
30+
- `--allow-net`: allows network access to the plugins, you can specify a list of domains comma separated (by default, no network access is allowed)
31+
- `--allow-read`: allows read access to the filesystem
32+
- `--allow-write`: allows write access to the filesystem
33+
- `--allow-all`: allows all permissions (same as all the flags above), short: `-A`
34+
35+
This is what it means by plugins being "sandboxed by default" - you can take any plugin from anywhere, if you don't allow any access, it won't be able to make any network request or read/write to your filesystem and it will be constrained to its own part of the memory.
36+
2837
More details on the github repo: [topheman/webassembly-component-model-experiments](https://github.com/topheman/webassembly-component-model-experiments).
2938

3039
## Install
@@ -44,12 +53,17 @@ pluginlab\
4453
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_ls.wasm\
4554
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm\
4655
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm\
47-
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
56+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
57+
--allow-all
4858
```
4959

5060
Other flags:
5161

5262
- `--dir`: directory to be preopened (by default, the current directory)
63+
- `--allow-net`: allows network access to the plugins, you can specify a list of domains comma separated (by default, no network access is allowed)
64+
- `--allow-read`: allows read access to the filesystem
65+
- `--allow-write`: allows write access to the filesystem
66+
- `--allow-all`: allows all permissions (same as all the flags above), short: `-A`
5367
- `--help`: displays manual
5468
- `--debug`: run the host in debug mode (by default, the host runs in release mode)
5569

@@ -63,7 +77,8 @@ pluginlab\
6377
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_ls.wasm\
6478
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm\
6579
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm\
66-
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
80+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
81+
--allow-all
6782
[Host] Starting REPL host...
6883
[Host] Loading REPL logic from: https://topheman.github.io/webassembly-component-model-experiments/plugins/repl_logic_guest.wasm
6984
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_greet.wasm

0 commit comments

Comments
 (0)