capsite/toybox: a grant is an object in env, not the vat's global fetch

A vat's globalOutbound is now always null. A granted host arrives as
env.egress, an Egress the app can hand to whichever of its parts should
have it; as globalOutbound it was ambient to every module in the vat.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
dckcandClaude Opus 5.5 committed 2026-10-13 21:44:29 -05:00
1 parent 7bf6eb44c7
commit 2820c015ee
4 files changed
+20 -13

No files matched your search

+7 -2
View File
@@ -167,9 +167,14 @@ test("a vat granted a host reaches it through the switchboard: fetch and WebSock
assert.equal(await probe("erin", echo.host, true), "echo: hello\n");
});
test("same code, no grant: no fetch", async () => {
test("same code, no grant: no egress", async () => {
await admin.install("frank", await app("egress-probe.js"));
assert.match(await probe("frank", echo.host), /^refused: This worker is not permitted to access the internet/);
assert.equal(await probe("frank", echo.host), "no egress granted\n");
});
test("a grant is an object, not ambient: the global fetch still throws", async () => {
await admin.install("heidi", await app("try-fetch.js"), echo.host);
assert.match(await pub.get("heidi"), /^fetch refused: This worker is not permitted to access the internet/);
});
test("a grant covers one host only", async () => {