- MCP
- show on this site's /mcp
- CLI
- abso show 88 --json
- JSON
- /christopher/abso-core/versions/88?format=json
Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.
of shared·pinch··Not checked
Version 87 · Files at version 88
3 files, 56 lines added, 20 removed.
--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -179,6 +179,17 @@
181181
183+ * Every request this Api makes goes through here. In a visitor folder it never sends anything but a GET,
184+ * and follows no redirect, so nothing it sends goes anywhere it didn't name (headers() adds no sign-in).
192+
@@ -187,9 +198,8 @@
190− // A visitor folder only reads, and follows no redirect, so nothing it sends goes anywhere it didn't name.
191− const visitor = this.config.visitor === true;
192− if (visitor && method !== "GET") throw new ApiError(`${path}: a folder that reads signed out sends only reads`);
195205 // A connection that never opened is tried once more, IPv4 first (#37, GAME - UI/UX: one IPv6
@@ -197,11 +207,10 @@
200− res = await fetch(this.url(path, server), {
204− ...(visitor ? { redirect: "error" as const } : {}),
@@ -290,7 +299,7 @@
293− res = await fetch(`${this.url("/serve")}?${q}`, {
@@ -311,13 +320,16 @@
314− res = await fetch(`${this.url(this.agentPath("prep"))}?cmd=${encodeURIComponent(command)}${boxQuery(this.box)}`, {
315− method: "POST",
316− headers: this.headers("application/gzip"),
317− body: tarGz,
318− // A setup command can take minutes (npm ci, a browser download).
319− signal: AbortSignal.timeout(30 * 60_000),
320− });
@@ -333,7 +345,7 @@
336− res = await fetch(
337349 `${this.url(this.agentPath("prep"))}${this.box ? `?box=${encodeURIComponent(this.box)}` : ""}`,
@@ -369,7 +381,7 @@
372− res = await fetch(this.url(path), {
@@ -491,7 +503,7 @@
494− res = await fetch(this.url(path, this.issuesServer), {
496508 headers: { ...this.headers("application/octet-stream"), "x-abso-name": encodeURIComponent(name) },
@@ -538,7 +550,7 @@
541− res = await fetch(url, {
@@ -936,7 +948,7 @@
939− res = await fetch(followUrl(this, id, { at: 0, errAt: 0 }), { headers: this.headers() });
--- a/client/src/box-run.ts
+++ b/client/src/box-run.ts
@@ -150,7 +150,7 @@
151151 // stderr=split: the box's stderr comes apart from stdout (7a5a111); older servers ignore it.
152152 // replace=1: stop the runs still going in the box first; without it the server answers 409 (#25).
153− const answer = await fetch(
154154 `${api.url(api.agentPath("run"))}?cmd=${encodeURIComponent(command)}&stderr=split${replace ? "&replace=1" : ""}${fresh ? "&fresh=1" : ""}${boxQuery(api.box)}`,
@@ -216,7 +216,7 @@
219− const res = await fetch(followUrl(api, id, seen), { headers: api.headers() });
--- a/client/test/visitor.test.ts
+++ b/client/test/visitor.test.ts
@@ -16,6 +16,7 @@
@@ -257,6 +258,29 @@
259260
261+ it("every request its Api makes goes through one send: reads only, no redirect, no sign-in", async () => {
269+ const visitor = new Api({ server: url, project: "abso-core", agent: "", visitor: true, token: TOKEN });
271+ await assert.rejects(visitor.send(`${url}/p/abso-core/a/x/run`, { method: "POST" }), /sends only reads/);
283+
260284 it("runs only its reads: every other command is refused before any call, and a new command fails here", async () => {