Experiment: Capability Denial(v2 · en)
Capability denial is the negative path of the capability boundary, run for real: same expression, same image, only the grant set changes — observe the typed refusal and the granted pass side by side (see Modules and Capability Boundaries). All observations come from real zioge CLI runs.
Seed code
The seed program saved into the image — it runs once at image save time, writing the note to a host file; the image itself stores static bindings only, carries neither file contents nor any authority:
(spit "/tmp/zioge-p6a-demo/note.txt" "written-at-prepare-time\n")
Preparation commands (host shell):
zio image save seed-note.zio -o note-image.zioge
mkdir -p empty-grants # an empty grant directory = zero grants
cat /tmp/zioge-p6a-demo/note.txt # confirm the prepare artifact exists
Expected observation: image save prints saved note-image.zioge (694 bytes, 1 roots); cat shows written-at-prepare-time.
Steps
Step 1: Observe the capability declaration surface (presence ≠ authorization)
Read the runtime's capability declaration inside the restored image session; map printing order is not a language guarantee, so the observation extracts fixed fields:
(def caps (language-capabilities))
(println (get caps :remote-restart))
(println (get (get caps :engines) :js))
zio image run note-image.zioge --eval '(def caps (language-capabilities)) (println (get caps :remote-restart)) (println (get (get caps :engines) :js))'
Expected observation: stdout is false then false (followed by the eval's final value nil), exit code 0. The engines table reports registration truth (it varies with host assembly — in plain script mode the same CLI reports :js true), not authorization state: resolvable symbols do not mean executable effects.
Step 2: A read outside the grants is typed-refused
Same image, zero-grant directory, evaluating a read of the prepare artifact:
(println (slurp "/tmp/zioge-p6a-demo/note.txt"))
zio image run note-image.zioge --eval '(println (slurp "/tmp/zioge-p6a-demo/note.txt"))' --grant-dir empty-grants
Expected observation: non-zero exit (exit 1), stderr Error: slurp error: file access denied: /tmp/zioge-p6a-demo/note.txt is outside every granted root at line 1, col 10, no stdout. The refusal happens, typed, at the effect boundary — the restored image inherited no authority from the saving process, and the path's existence does not matter.
Step 3: The same expression passes once the right root is granted
The only change: point the grant directory at the file's root. The eval expression is the same as Step 2's:
(println (slurp "/tmp/zioge-p6a-demo/note.txt"))
zio image run note-image.zioge --eval '(println (slurp "/tmp/zioge-p6a-demo/note.txt"))' --grant-dir /tmp/zioge-p6a-demo
Expected observation: stdout is written-at-prepare-time followed by the final value nil, exit code 0. Grants are declared per launch: same eval, same image — with --grant-dir at the right root the read passes; there is no channel for "growing grants mid-experiment".
步骤总览
| 步骤 | 预期观察 |
|---|---|
| Step 1: Observe the capability declaration surface (presence ≠ authorization) | stdout is =false= then =false= (followed by the eval's final value =nil=), exit code 0. The =engines= table reports registration truth (it varies with host assembly — in plain script mode the same CLI reports =:js true=), not authorization state: resolvable symbols do not mean executable effects. |
| Step 2: A read outside the grants is typed-refused | non-zero exit (exit 1), stderr =Error: slurp error: file access denied: /tmp/zioge-p6a-demo/note.txt is outside every granted root at line 1, col 10=, no stdout. The refusal happens, typed, at the effect boundary — the restored image inherited no authority from the saving process, and the path's existence does not matter. |
| Step 3: The same expression passes once the right root is granted | stdout is =written-at-prepare-time= followed by the final value =nil=, exit code 0. Grants are declared per launch: same eval, same image — with =--grant-dir= at the right root the read passes; there is no channel for "growing grants mid-experiment". |
无 JS 执行会话
下面的原生表单创建一个执行会话(服务端 P6-b runner 子进程求值,本页进程不执行用户代码);会话页内逐步运行、查看观察、重置或关闭。
JSON API 同一能力走 POST /api/experiments;两条路径共用同一 runner 合同。