fix(conversation): pi-unpin S4 sixth re-check: an engine node under /tmp no longer counts as one the fit check's sandbox shows, since pi-fit.mjs puts the fresh /tmp over it after it mounts that file, so a PATH with that node first refuses instead of letting the fit check run another node (R6-1); a lookup's problem line with a C1 control or a line or paragraph separator reads "the pi lookup gave no binary"; README and a test comment match (#1873, lane pi-unpin-s4)

This commit was merged in pull request #2015.
This commit is contained in:
jason.woltje committed 2026-11-20 06:30:10 -06:00
1 parent c065034a6e
commit 4a3f501e13
3 files changed
+12 -6

No files matched your search

+2 -1
View File
@@ -328,7 +328,8 @@ can disagree with it.
repository's `.bin`, then this process's PATH, as `sessionEnv` builds it),
and it looks inside the fit check's sandbox, which shows only `/usr`,
`/etc`, the host's `/bin`, `/lib`, `/lib64` and `/sbin`, and this Node's
own file at its path. Up to the first `node`, every entry must read the
own file at its path unless that path is under `/tmp` (the sandbox's fresh
`/tmp` covers it). Up to the first `node`, every entry must read the
same in the sandbox as on the host: absolute (env reads an empty or
relative one against the fit check's directory), already in plain form (a
`..` after a link goes where the link points), and not in `/proc` or
+6 -3
View File
@@ -175,8 +175,11 @@ const shownDir = (p) => SHOWN_DIRS.some((d) => p === d || p.startsWith(d + "/"))
// else inside it than on the host. Its /tmp is another directory too, but one
// that starts empty (pi-fit.mjs makes it fresh for each run), so an entry
// there holds no node in the sandbox, and a node the host finds there is one
// the sandbox can't show.
// the sandbox can't show. That holds for this Node's own file too: pi-fit.mjs
// puts the fresh /tmp in place after it mounts that file, so an engine whose
// node sits under /tmp is hidden in the sandbox.
const OWN_COPY_DIRS = ["/proc", "/dev"];
const underTmp = (p) => p === "/tmp" || p.startsWith("/tmp/");
function shownInFit(p, hops = 0) {
if (hops > 40) return null;
const parts = p.split("/").filter(Boolean);
@@ -193,7 +196,7 @@ function shownInFit(p, hops = 0) {
}
at = next;
}
return at === process.execPath || shownDir(at) ? at : null;
return (at === process.execPath && !underTmp(at)) || shownDir(at) ? at : null;
}
// #1873 S4: the lookup's answer, copied once into a frozen plain object of
@@ -332,7 +335,7 @@ export class Controller {
// The lookup's problem lines are words and its package's name; a
// hand-built one with a path or a control character in it isn't shown.
const problem = pi?.problem;
const plain = typeof problem === "string" && problem && !/[\x00-\x1f\x7f]/.test(problem) && !problem.replaceAll(PACKAGE, "").includes("/");
const plain = typeof problem === "string" && problem && !/[\x00-\x1f\x7f-\x9f\u2028\u2029]/.test(problem) && !problem.replaceAll(PACKAGE, "").includes("/");
const why = plain ? problem : "the pi lookup gave no binary";
throw new ControlRefusal(ENGINE_FEATURE_MISSING, why);
}
+4 -2
View File
@@ -937,8 +937,8 @@ test("S4h: a first line the kernel and node read differently refuses engine-feat
await onPath("/dev/mosaic-no-such-dir", () => refused(envPi.found, ownCopy, fx2));
symlinkSync("/proc", join(fx.base, "p"));
await onPath(`${fx.base}/p/999999999/root/usr/bin`, () => refused(envPi.found, ownCopy, fx2));
// A node link that leads nowhere on the host may lead somewhere in the
// sandbox (into its /tmp, say), so it can't be checked.
// A node link that leads nowhere on the host can't be checked: what the
// sandbox finds at its target need not be what the host lacks there.
const dangling = join(fx.base, "dangling-bin");
mkdirSync(dangling);
symlinkSync("/tmp/mosaic-no-such-dir/node", join(dangling, "node"));
@@ -1008,6 +1008,8 @@ test("S4h: a first line the kernel and node read differently refuses engine-feat
unbuilt(piAt(loose), `MOSAIC_PI_BIN isn't part of the ${PI_PACKAGE} package`);
unbuilt({ bin: null, problem: `${fx.base} has no pi` }, "the pi lookup gave no binary");
unbuilt({ bin: null, problem: "no pi\nrefused: forged" }, "the pi lookup gave no binary");
unbuilt({ bin: null, problem: "no pi\u2028refused: forged" }, "the pi lookup gave no binary");
unbuilt({ bin: null, problem: "no pi\u0085refused: forged" }, "the pi lookup gave no binary");
});
// ---- W11, W16, W17 ----------------------------------------------------------