@rotifer/playground 0.36.1 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/commands/agent-run.d.ts.map +1 -1
- package/dist/commands/agent-run.js +17 -14
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/hello.d.ts.map +1 -1
- package/dist/commands/hello.js +15 -10
- package/dist/commands/hello.js.map +1 -1
- package/dist/commands/publish.js +1 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +10 -7
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +22 -12
- package/dist/commands/test.js.map +1 -1
- package/dist/runtime/egress-guard.d.ts +30 -0
- package/dist/runtime/egress-guard.d.ts.map +1 -0
- package/dist/runtime/egress-guard.js +243 -0
- package/dist/runtime/egress-guard.js.map +1 -0
- package/dist/runtime/host-fetch.d.ts +4 -0
- package/dist/runtime/host-fetch.d.ts.map +1 -0
- package/dist/runtime/host-fetch.js +23 -0
- package/dist/runtime/host-fetch.js.map +1 -0
- package/dist/runtime/network-gateway.d.ts +27 -0
- package/dist/runtime/network-gateway.d.ts.map +1 -1
- package/dist/runtime/network-gateway.js +57 -14
- package/dist/runtime/network-gateway.js.map +1 -1
- package/dist/testsuite/gate.d.ts +8 -3
- package/dist/testsuite/gate.d.ts.map +1 -1
- package/dist/testsuite/gate.js +17 -7
- package/dist/testsuite/gate.js.map +1 -1
- package/dist/testsuite/run.d.ts +11 -5
- package/dist/testsuite/run.d.ts.map +1 -1
- package/dist/testsuite/run.js +11 -11
- package/dist/testsuite/run.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeneNeverSettledError = void 0;
|
|
4
|
+
exports.geneEgress = geneEgress;
|
|
5
|
+
exports.withGeneEgress = withGeneEgress;
|
|
6
|
+
exports.geneEgressFromDir = geneEgressFromDir;
|
|
7
|
+
/**
|
|
8
|
+
* Egress guard: while the CLI runs a gene's source under Node, the gene's
|
|
9
|
+
* global `fetch` (and `WebSocket` / `EventSource`) answer to the gene's own
|
|
10
|
+
* `network` declaration.
|
|
11
|
+
*
|
|
12
|
+
* Spec, Phenotype `NetworkConfig`: a Hybrid or Wrapped gene that makes HTTP
|
|
13
|
+
* requests SHOULD declare NetworkConfig so the sandbox can enforce a domain
|
|
14
|
+
* whitelist, timeouts and rate limits; a gene that declares none is treated
|
|
15
|
+
* as having no network access. `ctx.gatewayFetch` always applied that; a gene
|
|
16
|
+
* calling the global `fetch` used to bypass it.
|
|
17
|
+
*
|
|
18
|
+
* How:
|
|
19
|
+
* - `withGeneEgress(egress, fn)` runs `fn` (importing the gene, calling
|
|
20
|
+
* `express` or `display`) inside an AsyncLocalStorage context naming the
|
|
21
|
+
* gene, and waits for what it returns to settle. On entry the first window
|
|
22
|
+
* puts guards in `globalThis.fetch` / `WebSocket` / `EventSource`; when the
|
|
23
|
+
* last window closes the original property descriptors go back, so the
|
|
24
|
+
* globals are the very objects they were.
|
|
25
|
+
* - A gene that never settles: if Node's event loop empties while a call is
|
|
26
|
+
* still waiting on the gene, nothing is left that could ever settle it, and
|
|
27
|
+
* Node would exit there with code 0. The call fails instead with
|
|
28
|
+
* `GeneNeverSettledError`, so the command reports it and exits non-zero.
|
|
29
|
+
* Its window stays open: the gene's code could still run (a timer that does
|
|
30
|
+
* not keep the process alive), and it is still held to its declaration.
|
|
31
|
+
* - The fetch guard reads the context. No gene in it: the call is the CLI's
|
|
32
|
+
* own (an invocation report or heartbeat in flight), and goes straight to
|
|
33
|
+
* the original fetch. A gene with no `network`: refused. Otherwise: the
|
|
34
|
+
* gene's gateway — the same one behind `ctx.gatewayFetch`, so one allow-list,
|
|
35
|
+
* one timeout, one rate limit, one count.
|
|
36
|
+
* - WebSockets and EventSources from a gene are refused: the gateway carries
|
|
37
|
+
* HTTP requests only.
|
|
38
|
+
*
|
|
39
|
+
* What this is not: a sandbox. A gene under Node runs with the host's full
|
|
40
|
+
* privileges. This does not reach `node:http` / `node:https` / `node:http2` /
|
|
41
|
+
* `node:net` / `node:tls` / `node:dgram`, a child process (`curl`), a worker
|
|
42
|
+
* thread's own globals, DNS lookups, callbacks that run outside the gene's
|
|
43
|
+
* async context (a `process.on("exit")` listener), or a timer that fires
|
|
44
|
+
* after the gene has returned and the globals are restored. Isolation is the
|
|
45
|
+
* WASM sandbox's job, where the only way out is `rotifer.net.fetch`.
|
|
46
|
+
*/
|
|
47
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
48
|
+
const node_fs_1 = require("node:fs");
|
|
49
|
+
const node_path_1 = require("node:path");
|
|
50
|
+
const network_gateway_js_1 = require("./network-gateway.js");
|
|
51
|
+
const host_fetch_js_1 = require("./host-fetch.js");
|
|
52
|
+
/**
|
|
53
|
+
* The network rights a phenotype declares: a gateway when it has a `network`
|
|
54
|
+
* block (any fidelity — the spec names Hybrid and Wrapped), none otherwise.
|
|
55
|
+
* `testOptions` is the gateway's binding-internal test hook; the CLI never
|
|
56
|
+
* passes it.
|
|
57
|
+
*/
|
|
58
|
+
function geneEgress(geneName, phenotype, testOptions) {
|
|
59
|
+
const network = phenotype?.network;
|
|
60
|
+
if (!network || typeof network !== "object")
|
|
61
|
+
return { geneName };
|
|
62
|
+
const gateway = new network_gateway_js_1.NetworkGateway(network, testOptions);
|
|
63
|
+
return { geneName, gateway, gatewayFetch: (url, options) => gateway.fetch(url, options) };
|
|
64
|
+
}
|
|
65
|
+
const running = new node_async_hooks_1.AsyncLocalStorage();
|
|
66
|
+
const GUARDED_GLOBALS = ["fetch", "WebSocket", "EventSource"];
|
|
67
|
+
let openWindows = 0;
|
|
68
|
+
let saved = null;
|
|
69
|
+
/** Run `fn` as the gene `egress` names: its global fetch answers to its declaration. */
|
|
70
|
+
function withGeneEgress(egress, fn) {
|
|
71
|
+
install();
|
|
72
|
+
let call;
|
|
73
|
+
try {
|
|
74
|
+
call = Promise.resolve(running.run(egress, fn));
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
uninstall();
|
|
78
|
+
return Promise.reject(err);
|
|
79
|
+
}
|
|
80
|
+
// The window closes when the gene is done, and not before, however long that takes.
|
|
81
|
+
call.then(uninstall, uninstall);
|
|
82
|
+
return untilSettled(call, egress.geneName);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A call into a gene that was still waiting when Node's event loop emptied:
|
|
86
|
+
* nothing was left that could settle it.
|
|
87
|
+
*/
|
|
88
|
+
class GeneNeverSettledError extends Error {
|
|
89
|
+
constructor(geneName) {
|
|
90
|
+
super(`Gene '${geneName}' never finished: it was still waiting on a Promise when nothing else was left to run, ` +
|
|
91
|
+
`so nothing could ever settle it`);
|
|
92
|
+
this.name = "GeneNeverSettledError";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.GeneNeverSettledError = GeneNeverSettledError;
|
|
96
|
+
/** One entry per call still waiting on a gene: what to do if it never settles. */
|
|
97
|
+
const waiting = new Set();
|
|
98
|
+
let isWatching = false;
|
|
99
|
+
/** `call`, or a GeneNeverSettledError once the event loop has emptied while it waits. */
|
|
100
|
+
function untilSettled(call, geneName) {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const giveUp = () => reject(new GeneNeverSettledError(geneName));
|
|
103
|
+
waiting.add(giveUp);
|
|
104
|
+
watchForEmptyLoop();
|
|
105
|
+
call.then((value) => {
|
|
106
|
+
waiting.delete(giveUp);
|
|
107
|
+
resolve(value);
|
|
108
|
+
}, (err) => {
|
|
109
|
+
waiting.delete(giveUp);
|
|
110
|
+
reject(err);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* `beforeExit` fires when the loop empties. Each waiting call is failed once:
|
|
116
|
+
* the set is emptied before any is failed. Node fires it again only if the
|
|
117
|
+
* listener leaves the loop work to do — what the failed calls' callers do
|
|
118
|
+
* next runs as microtasks, which do not count — so it queues an empty
|
|
119
|
+
* macrotask: a command that goes on after a call fails (T1's next case) is
|
|
120
|
+
* watched the same way when the loop empties again. A long-running process (a
|
|
121
|
+
* server) never empties its loop, so this never fires there.
|
|
122
|
+
*/
|
|
123
|
+
function watchForEmptyLoop() {
|
|
124
|
+
if (isWatching)
|
|
125
|
+
return;
|
|
126
|
+
isWatching = true;
|
|
127
|
+
process.on("beforeExit", () => {
|
|
128
|
+
const stuck = [...waiting];
|
|
129
|
+
if (stuck.length === 0)
|
|
130
|
+
return;
|
|
131
|
+
waiting.clear();
|
|
132
|
+
for (const giveUp of stuck)
|
|
133
|
+
giveUp();
|
|
134
|
+
setImmediate(() => { });
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/** The gene's network rights, read from the phenotype.json beside its source. None if there is none. */
|
|
138
|
+
function geneEgressFromDir(geneDir, fallbackName) {
|
|
139
|
+
let phenotype = {};
|
|
140
|
+
try {
|
|
141
|
+
phenotype = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(geneDir, "phenotype.json"), "utf-8"));
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// no readable phenotype: the gene declares nothing, so it reaches nothing
|
|
145
|
+
}
|
|
146
|
+
const name = typeof phenotype.name === "string" ? phenotype.name : fallbackName;
|
|
147
|
+
return geneEgress(name, phenotype);
|
|
148
|
+
}
|
|
149
|
+
function install() {
|
|
150
|
+
if (openWindows++ > 0)
|
|
151
|
+
return;
|
|
152
|
+
saved = new Map(GUARDED_GLOBALS.map((name) => [name, Object.getOwnPropertyDescriptor(globalThis, name)]));
|
|
153
|
+
const original = globalThis.fetch;
|
|
154
|
+
(0, host_fetch_js_1.setReplacedFetch)(original);
|
|
155
|
+
defineGlobal("fetch", guardFetch(original));
|
|
156
|
+
for (const name of ["WebSocket", "EventSource"]) {
|
|
157
|
+
const Real = globalThis[name];
|
|
158
|
+
if (typeof Real === "function")
|
|
159
|
+
defineGlobal(name, guardConstructor(name, Real));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function uninstall() {
|
|
163
|
+
if (--openWindows > 0)
|
|
164
|
+
return;
|
|
165
|
+
for (const [name, descriptor] of saved ?? []) {
|
|
166
|
+
if (descriptor)
|
|
167
|
+
Object.defineProperty(globalThis, name, descriptor);
|
|
168
|
+
else
|
|
169
|
+
delete globalThis[name];
|
|
170
|
+
}
|
|
171
|
+
saved = null;
|
|
172
|
+
(0, host_fetch_js_1.setReplacedFetch)(null);
|
|
173
|
+
}
|
|
174
|
+
function defineGlobal(name, value) {
|
|
175
|
+
Object.defineProperty(globalThis, name, { value, writable: true, configurable: true, enumerable: false });
|
|
176
|
+
}
|
|
177
|
+
function hostOf(url) {
|
|
178
|
+
try {
|
|
179
|
+
return new URL(url).hostname;
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return url;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function undeclared(gene, what, host) {
|
|
186
|
+
return new network_gateway_js_1.NetworkGatewayError("DOMAIN_BLOCKED", `Gene '${gene}' declares no network access, so ${what} was refused. ` +
|
|
187
|
+
`To allow it, declare the host in phenotype.json: "network": { "allowedDomains": ["${host}"] }`);
|
|
188
|
+
}
|
|
189
|
+
function withHint(err) {
|
|
190
|
+
if (err instanceof network_gateway_js_1.NetworkGatewayError && err.code === "DOMAIN_BLOCKED" && err.message.startsWith("Domain ")) {
|
|
191
|
+
return new network_gateway_js_1.NetworkGatewayError(err.code, `${err.message} — a gene reaches only the hosts in phenotype.json "network": { "allowedDomains": [...] }; add the host there to allow it`);
|
|
192
|
+
}
|
|
193
|
+
return err;
|
|
194
|
+
}
|
|
195
|
+
/** Statuses a Response must have no body for. */
|
|
196
|
+
const NULL_BODY = new Set([101, 103, 204, 205, 304]);
|
|
197
|
+
function toResponse(raw) {
|
|
198
|
+
const body = NULL_BODY.has(raw.status) ? null : raw.bytes;
|
|
199
|
+
return new Response(body, { status: raw.status, statusText: raw.statusText, headers: raw.headers });
|
|
200
|
+
}
|
|
201
|
+
function guardFetch(original) {
|
|
202
|
+
const guarded = async (input, init) => {
|
|
203
|
+
const egress = running.getStore();
|
|
204
|
+
if (!egress)
|
|
205
|
+
return original(input, init);
|
|
206
|
+
const request = new Request(input, init);
|
|
207
|
+
const host = hostOf(request.url);
|
|
208
|
+
if (!egress.gateway)
|
|
209
|
+
throw undeclared(egress.geneName, `fetch("${request.url}")`, host);
|
|
210
|
+
let raw;
|
|
211
|
+
try {
|
|
212
|
+
raw = await egress.gateway.request(request.url, {
|
|
213
|
+
method: request.method,
|
|
214
|
+
headers: Object.fromEntries(request.headers),
|
|
215
|
+
body: request.body ? new Uint8Array(await request.arrayBuffer()) : undefined,
|
|
216
|
+
signal: request.signal,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
throw withHint(err);
|
|
221
|
+
}
|
|
222
|
+
// A cut-off body would surface as a JSON parse error in the gene; say what happened.
|
|
223
|
+
if (raw.isTruncated) {
|
|
224
|
+
throw new network_gateway_js_1.NetworkGatewayError("RESPONSE_TOO_LARGE", `Response from ${host} is larger than the gene's network.maxResponseBytes`);
|
|
225
|
+
}
|
|
226
|
+
return toResponse(raw);
|
|
227
|
+
};
|
|
228
|
+
return guarded;
|
|
229
|
+
}
|
|
230
|
+
function guardConstructor(name, Real) {
|
|
231
|
+
return new Proxy(Real, {
|
|
232
|
+
construct(target, args, newTarget) {
|
|
233
|
+
const egress = running.getStore();
|
|
234
|
+
if (egress) {
|
|
235
|
+
throw new network_gateway_js_1.NetworkGatewayError("DOMAIN_BLOCKED", `Gene '${egress.geneName}' opened a ${name} to ${hostOf(String(args[0]))}, which is refused: ` +
|
|
236
|
+
`under the CLI a gene reaches the network only with HTTP requests (fetch or ctx.gatewayFetch) ` +
|
|
237
|
+
`to the hosts in phenotype.json "network": { "allowedDomains": [...] }`);
|
|
238
|
+
}
|
|
239
|
+
return Reflect.construct(target, args, newTarget);
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=egress-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress-guard.js","sourceRoot":"","sources":["../../src/runtime/egress-guard.ts"],"names":[],"mappings":";;;AAqEA,gCASC;AASD,wCAYC;AA6DD,8CASC;AAzKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,uDAAqD;AACrD,qCAAuC;AACvC,yCAAiC;AACjC,6DAQ8B;AAC9B,mDAAmD;AAWnD;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,QAAgB,EAChB,SAAmD,EACnD,WAAgC;IAEhC,MAAM,OAAO,GAAG,SAAS,EAAE,OAAO,CAAC;IACnC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,mCAAc,CAAC,OAAiC,EAAE,WAAW,CAAC,CAAC;IACnF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;AAC5F,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,oCAAiB,EAAc,CAAC;AAEpD,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAU,CAAC;AACvE,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,KAAK,GAAuD,IAAI,CAAC;AAErE,wFAAwF;AACxF,SAAgB,cAAc,CAAI,MAAkB,EAAE,EAAwB;IAC5E,OAAO,EAAE,CAAC;IACV,IAAI,IAAgB,CAAC;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M,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,wCAAmB,CAC3B,gBAAgB,EAChB,SAAS,MAAM,CAAC,QAAQ,cAAc,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;oBAC5F,+FAA+F;oBAC/F,uEAAuE,CAC1E,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACpD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-fetch.d.ts","sourceRoot":"","sources":["../../src/runtime/host-fetch.ts"],"names":[],"mappings":"AAYA,wBAAgB,SAAS,IAAI,OAAO,KAAK,CAExC;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,KAAK,GAAG,IAAI,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hostFetch = hostFetch;
|
|
4
|
+
exports.setReplacedFetch = setReplacedFetch;
|
|
5
|
+
/**
|
|
6
|
+
* The fetch the CLI itself sends with.
|
|
7
|
+
*
|
|
8
|
+
* While a gene runs, the egress guard (egress-guard.ts) puts its own function
|
|
9
|
+
* in `globalThis.fetch`. Code that must reach the network on the gene's
|
|
10
|
+
* behalf — the network gateway — goes out through the fetch the guard
|
|
11
|
+
* replaced, or it would be checked against the gene a second time. With no
|
|
12
|
+
* guard installed this is simply the current global fetch, so a test that
|
|
13
|
+
* stubs `globalThis.fetch` still sees its stub.
|
|
14
|
+
*/
|
|
15
|
+
let replaced = null;
|
|
16
|
+
function hostFetch() {
|
|
17
|
+
return replaced ?? globalThis.fetch;
|
|
18
|
+
}
|
|
19
|
+
/** Called by the egress guard only: the fetch it replaced, or null once it is restored. */
|
|
20
|
+
function setReplacedFetch(fn) {
|
|
21
|
+
replaced = fn;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=host-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-fetch.js","sourceRoot":"","sources":["../../src/runtime/host-fetch.ts"],"names":[],"mappings":";;AAYA,8BAEC;AAGD,4CAEC;AAnBD;;;;;;;;;GASG;AACH,IAAI,QAAQ,GAAwB,IAAI,CAAC;AAEzC,SAAgB,SAAS;IACvB,OAAO,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC;AACtC,CAAC;AAED,2FAA2F;AAC3F,SAAgB,gBAAgB,CAAC,EAAuB;IACtD,QAAQ,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* `check_url` / `perform_fetch`, Hybrid Binding API §2.1): https only, no IP
|
|
10
10
|
* literals, and redirects followed by hand, at most MAX_REDIRECT_HOPS, each
|
|
11
11
|
* hop checked against the whitelist before it is requested.
|
|
12
|
+
*
|
|
13
|
+
* While the CLI runs a gene, the gene's global `fetch` is routed here too
|
|
14
|
+
* (egress-guard.ts). The gateway's own requests therefore go out through
|
|
15
|
+
* `hostFetch()`, the fetch the guard replaced, never through the guard.
|
|
12
16
|
*/
|
|
13
17
|
/** Same as rotifer-core `constants::MAX_REDIRECT_HOPS`. */
|
|
14
18
|
export declare const MAX_REDIRECT_HOPS = 5;
|
|
@@ -29,6 +33,22 @@ export interface GatewayResponse {
|
|
|
29
33
|
body: string;
|
|
30
34
|
isTruncated: boolean;
|
|
31
35
|
}
|
|
36
|
+
/** A request as the egress guard hands it over: what a fetch() call carried. */
|
|
37
|
+
export interface GatewayRawRequest {
|
|
38
|
+
method: string;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
/** A string keeps fetch's text/plain default content type, as gatewayFetch always had. */
|
|
41
|
+
body?: string | Uint8Array<ArrayBuffer>;
|
|
42
|
+
signal?: AbortSignal | null;
|
|
43
|
+
}
|
|
44
|
+
/** The response before it is decoded, for the egress guard to wrap in a Response. */
|
|
45
|
+
export interface GatewayRawResponse {
|
|
46
|
+
status: number;
|
|
47
|
+
statusText: string;
|
|
48
|
+
headers: [string, string][];
|
|
49
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
50
|
+
isTruncated: boolean;
|
|
51
|
+
}
|
|
32
52
|
export declare class NetworkGatewayError extends Error {
|
|
33
53
|
readonly code: "DOMAIN_BLOCKED" | "INVALID_REQUEST" | "RATE_LIMITED" | "TIMEOUT" | "RESPONSE_TOO_LARGE" | "NETWORK_ERROR";
|
|
34
54
|
constructor(code: "DOMAIN_BLOCKED" | "INVALID_REQUEST" | "RATE_LIMITED" | "TIMEOUT" | "RESPONSE_TOO_LARGE" | "NETWORK_ERROR", message: string);
|
|
@@ -53,6 +73,13 @@ export declare class NetworkGateway {
|
|
|
53
73
|
windowRequests: number;
|
|
54
74
|
};
|
|
55
75
|
fetch(url: string, options?: GatewayFetchOptions): Promise<GatewayResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* The same request, with fetch's own shape: the method as given (fetch
|
|
78
|
+
* defaults to GET, `fetch()` above to POST), a byte body, the caller's
|
|
79
|
+
* abort signal. Used by the egress guard; same checks, same counts.
|
|
80
|
+
*/
|
|
81
|
+
request(url: string, req: GatewayRawRequest): Promise<GatewayRawResponse>;
|
|
82
|
+
private send;
|
|
56
83
|
/** Whitelist first, then scheme and host shape. Runs for the first request
|
|
57
84
|
* and for every redirect hop. rotifer-core's `check_url` checks shape first;
|
|
58
85
|
* here a URL off the whitelist keeps the DOMAIN_BLOCKED callers have always
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-gateway.d.ts","sourceRoot":"","sources":["../../src/runtime/network-gateway.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"network-gateway.d.ts","sour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iB,GACjB,cAAc,GACd,SAAS,GACT,oBAAoB,GACpB,eAAe;gBANH,IAAI,EAChB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,SAAS,GACT,oBAAoB,GACpB,eAAe,EACnB,OAAO,EAAE,MAAM;CAKlB;AAkBD,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC;;yEAEqE;IACrE,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,qBAAqB,CAAU;IACvC,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAAK;gBAEX,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,WAAW,GAAE,kBAAuB;IAKjF,IAAI,KAAK;;;;MAMR;IAEK,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAgBjF;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAIjE,IAAI;IAkGlB;;;;oDAIgD;IAChD,OAAO,CAAC,WAAW;IA6CnB,OAAO,CAAC,gBAAgB;YAiBV,cAAc;CAsC7B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7B;IACD,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACvF,OAAO,EAAE,cAAc,CAAC;CACzB,CAMA"}
|
|
@@ -10,10 +10,15 @@
|
|
|
10
10
|
* `check_url` / `perform_fetch`, Hybrid Binding API §2.1): https only, no IP
|
|
11
11
|
* literals, and redirects followed by hand, at most MAX_REDIRECT_HOPS, each
|
|
12
12
|
* hop checked against the whitelist before it is requested.
|
|
13
|
+
*
|
|
14
|
+
* While the CLI runs a gene, the gene's global `fetch` is routed here too
|
|
15
|
+
* (egress-guard.ts). The gateway's own requests therefore go out through
|
|
16
|
+
* `hostFetch()`, the fetch the guard replaced, never through the guard.
|
|
13
17
|
*/
|
|
14
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
19
|
exports.NetworkGateway = exports.NetworkGatewayError = exports.MAX_REDIRECT_HOPS = void 0;
|
|
16
20
|
exports.createGatewayFetch = createGatewayFetch;
|
|
21
|
+
const host_fetch_js_1 = require("./host-fetch.js");
|
|
17
22
|
/** Same as rotifer-core `constants::MAX_REDIRECT_HOPS`. */
|
|
18
23
|
exports.MAX_REDIRECT_HOPS = 5;
|
|
19
24
|
class NetworkGatewayError extends Error {
|
|
@@ -57,10 +62,40 @@ class NetworkGateway {
|
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
async fetch(url, options) {
|
|
65
|
+
const raw = await this.send(url, {
|
|
66
|
+
method: options?.method || "POST",
|
|
67
|
+
headers: options?.headers,
|
|
68
|
+
body: options?.body,
|
|
69
|
+
});
|
|
70
|
+
const headers = {};
|
|
71
|
+
for (const [k, v] of raw.headers)
|
|
72
|
+
headers[k] = v;
|
|
73
|
+
return {
|
|
74
|
+
status: raw.status,
|
|
75
|
+
headers,
|
|
76
|
+
body: new TextDecoder().decode(raw.bytes),
|
|
77
|
+
isTruncated: raw.isTruncated,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The same request, with fetch's own shape: the method as given (fetch
|
|
82
|
+
* defaults to GET, `fetch()` above to POST), a byte body, the caller's
|
|
83
|
+
* abort signal. Used by the egress guard; same checks, same counts.
|
|
84
|
+
*/
|
|
85
|
+
async request(url, req) {
|
|
86
|
+
return this.send(url, req);
|
|
87
|
+
}
|
|
88
|
+
async send(url, req) {
|
|
60
89
|
this.validateUrl(url);
|
|
61
90
|
this.enforceRateLimit();
|
|
62
91
|
const controller = new AbortController();
|
|
63
92
|
const timeout = setTimeout(() => controller.abort(), this.config.maxTimeoutMs);
|
|
93
|
+
const callerSignal = req.signal ?? undefined;
|
|
94
|
+
const onCallerAbort = () => controller.abort(callerSignal?.reason);
|
|
95
|
+
if (callerSignal?.aborted)
|
|
96
|
+
controller.abort(callerSignal.reason);
|
|
97
|
+
else
|
|
98
|
+
callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
64
99
|
try {
|
|
65
100
|
// Redirects are followed here, not by fetch: fetch would follow a
|
|
66
101
|
// whitelisted host's 302 to anywhere. Every hop is checked before it
|
|
@@ -74,14 +109,15 @@ class NetworkGateway {
|
|
|
74
109
|
// X-Api-Key or apikey, and the next host is someone else even when
|
|
75
110
|
// it matches the same *.domain wildcard.
|
|
76
111
|
let current = url;
|
|
77
|
-
let method =
|
|
78
|
-
let requestHeaders =
|
|
79
|
-
let body =
|
|
112
|
+
let method = req.method;
|
|
113
|
+
let requestHeaders = req.headers;
|
|
114
|
+
let body = req.body;
|
|
80
115
|
let response;
|
|
116
|
+
const send = (0, host_fetch_js_1.hostFetch)();
|
|
81
117
|
for (let hop = 0; hop <= exports.MAX_REDIRECT_HOPS; hop++) {
|
|
82
118
|
if (hop > 0)
|
|
83
119
|
this.validateUrl(current);
|
|
84
|
-
response = await
|
|
120
|
+
response = await send(current, {
|
|
85
121
|
method,
|
|
86
122
|
headers: requestHeaders,
|
|
87
123
|
body,
|
|
@@ -108,23 +144,26 @@ class NetworkGateway {
|
|
|
108
144
|
}
|
|
109
145
|
if (!response)
|
|
110
146
|
throw new Error("no response");
|
|
111
|
-
const {
|
|
147
|
+
const { bytes, isTruncated } = await this.readBodyCapped(response);
|
|
112
148
|
this.totalRequests++;
|
|
113
|
-
this.totalBytes +=
|
|
114
|
-
const headers =
|
|
149
|
+
this.totalBytes += bytes.length;
|
|
150
|
+
const headers = [];
|
|
115
151
|
response.headers.forEach((v, k) => {
|
|
116
|
-
headers[k
|
|
152
|
+
headers.push([k, v]);
|
|
117
153
|
});
|
|
118
154
|
return {
|
|
119
155
|
status: response.status,
|
|
156
|
+
statusText: response.statusText,
|
|
120
157
|
headers,
|
|
121
|
-
|
|
158
|
+
bytes,
|
|
122
159
|
isTruncated,
|
|
123
160
|
};
|
|
124
161
|
}
|
|
125
162
|
catch (err) {
|
|
126
163
|
if (err instanceof NetworkGatewayError)
|
|
127
164
|
throw err;
|
|
165
|
+
if (err.name === "AbortError" && callerSignal?.aborted)
|
|
166
|
+
throw callerSignal.reason ?? err;
|
|
128
167
|
if (err.name === "AbortError") {
|
|
129
168
|
throw new NetworkGatewayError("TIMEOUT", `Request to ${url} timed out after ${this.config.maxTimeoutMs}ms`);
|
|
130
169
|
}
|
|
@@ -132,6 +171,7 @@ class NetworkGateway {
|
|
|
132
171
|
}
|
|
133
172
|
finally {
|
|
134
173
|
clearTimeout(timeout);
|
|
174
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
135
175
|
}
|
|
136
176
|
}
|
|
137
177
|
/** Whitelist first, then scheme and host shape. Runs for the first request
|
|
@@ -179,7 +219,7 @@ class NetworkGateway {
|
|
|
179
219
|
async readBodyCapped(response) {
|
|
180
220
|
const reader = response.body?.getReader();
|
|
181
221
|
if (!reader) {
|
|
182
|
-
return {
|
|
222
|
+
return { bytes: new Uint8Array(0), isTruncated: false };
|
|
183
223
|
}
|
|
184
224
|
const chunks = [];
|
|
185
225
|
let totalSize = 0;
|
|
@@ -200,10 +240,13 @@ class NetworkGateway {
|
|
|
200
240
|
chunks.push(value);
|
|
201
241
|
totalSize += value.length;
|
|
202
242
|
}
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
243
|
+
const bytes = new Uint8Array(chunks.reduce((n, c) => n + c.length, 0));
|
|
244
|
+
let at = 0;
|
|
245
|
+
for (const c of chunks) {
|
|
246
|
+
bytes.set(c, at);
|
|
247
|
+
at += c.length;
|
|
248
|
+
}
|
|
249
|
+
return { bytes, isTruncated };
|
|
207
250
|
}
|
|
208
251
|
}
|
|
209
252
|
exports.NetworkGateway = NetworkGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-gateway.js","sourceRoot":"","sources":["../../src/runtime/network-gateway.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"network-gateway.js","sourceRoot":"","sources":["../../src/runtime/network-gateway.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAmVH,gDAWC;AA5VD,mDAA4C;AAE5C,2DAA2D;AAC9C,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAwCnC,MAAa,mBAAoB,SAAQ,KAAK;IAE1B;IADlB,YACkB,IAMG,EACnB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QATC,SAAI,GAAJ,IAAI,CAMD;QAInB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAdD,kDAcC;AAED,MAAM,cAAc,GAAkB;IACpC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,MAAM;IACpB,gBAAgB,EAAE,SAAS,EAAE,QAAQ;IACrC,iBAAiB,EAAE,EAAE;CACtB,CAAC;AAEF;qEACqE;AACrE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE7H,SAAS,kBAAkB,CAAC,OAA2C;IACrE,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IAC7B,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;AACzG,CAAC;AA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,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;QAC3D,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/testsuite/gate.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface GateInput {
|
|
|
32
32
|
* available — see the not-applicable branch. */
|
|
33
33
|
run: GeneRunner | null;
|
|
34
34
|
}
|
|
35
|
-
export declare function evaluatePublishGate(input: GateInput): GateVerdict
|
|
35
|
+
export declare function evaluatePublishGate(input: GateInput): Promise<GateVerdict>;
|
|
36
36
|
/** Adapter from the sandbox's result to a RunOutcome, shared by `rotifer test`
|
|
37
37
|
* and `rotifer publish`. An ADR-334 refusal is a refusal, as on the Node path
|
|
38
38
|
* (readErrorEnvelope): ADR-334 counts explicit INVALID_INPUT as handling, not a
|
|
@@ -59,8 +59,9 @@ export declare function outcomeFromSandbox(r: {
|
|
|
59
59
|
* through the gap — the shape of thing this plan exists to stop. So the hole is
|
|
60
60
|
* closed first, and the relabel then costs what it should.
|
|
61
61
|
*
|
|
62
|
-
* Async because a dynamic import is: the module is loaded once here
|
|
63
|
-
* returned runner is
|
|
62
|
+
* Async because a dynamic import is: the module is loaded once here. The
|
|
63
|
+
* returned runner is async too: it answers when `express` has settled, so an
|
|
64
|
+
* async `express` is judged on what it resolves to, as under `rotifer run`.
|
|
64
65
|
*
|
|
65
66
|
* The L0 gate is consulted BEFORE the import, not before express(): importing
|
|
66
67
|
* executes module top-level code, so a check afterwards checks nothing.
|
|
@@ -79,6 +80,10 @@ export declare function readErrorEnvelope(output: unknown): string | null;
|
|
|
79
80
|
* `ctx` is what express() gets as its second argument. ctx.memory is never
|
|
80
81
|
* undefined: without an agent memory to hand over,
|
|
81
82
|
* every memory call is MEMORY_ACCESS_DENIED "no agent context".
|
|
83
|
+
*
|
|
84
|
+
* The gene's import and every express() call answer to the `network` block of
|
|
85
|
+
* the phenotype.json beside its source, as under `rotifer test` and `run`:
|
|
86
|
+
* read here, so neither caller (test, publish) can leave it out.
|
|
82
87
|
*/
|
|
83
88
|
export declare function loadNodeRunner(absSourcePath: string, l0: {
|
|
84
89
|
kind: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/testsuite/gate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/testsuite/gate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE1E;;;;;;;;;GASG;AAEH,MAAM,MAAM,WAAW,GACnB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAoBjD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7D;oDACgD;IAChD,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;CACxB;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAyEhF;AAMD;;;;;kBAKkB;AAClB,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IACpC,OAAO,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