@ai-ecoverse/slicc-kernel 1.196.22 → 1.196.23
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/README.md +2 -2
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +38 -20
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +38 -20
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +38 -20
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/commands.d.ts +1 -0
- package/dist/types/sudo-files.d.ts +4 -1
- package/dist/types/sudo.d.ts +1 -1
- package/package.json +2 -2
package/dist/cloudflare.js
CHANGED
|
@@ -5241,7 +5241,7 @@ function satisfies(version, range2) {
|
|
|
5241
5241
|
}
|
|
5242
5242
|
|
|
5243
5243
|
// src/version.ts
|
|
5244
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
5244
|
+
var KERNEL_VERSION = true ? "1.196.23" : "0.0.0-dev";
|
|
5245
5245
|
var OS_RELEASE = "6.0.0-slicc";
|
|
5246
5246
|
function procVersion() {
|
|
5247
5247
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -5386,14 +5386,16 @@ function commandsOf(pkg, manifest) {
|
|
|
5386
5386
|
}
|
|
5387
5387
|
return out;
|
|
5388
5388
|
}
|
|
5389
|
-
async function withPackagePaths(fs, pkg, command) {
|
|
5389
|
+
async function withPackagePaths(fs, pkg, command, provenance) {
|
|
5390
5390
|
if (!command.env) return command;
|
|
5391
5391
|
const env = {};
|
|
5392
|
+
const envPaths = /* @__PURE__ */ new Set();
|
|
5392
5393
|
for (const [key, value2] of Object.entries(command.env)) {
|
|
5393
5394
|
const path = !value2.startsWith("/") && value2.includes("/") && inside(pkg, value2);
|
|
5395
|
+
if (path && provenance) envPaths.add(path);
|
|
5394
5396
|
env[key] = path && await fs.exists(path) ? path : value2;
|
|
5395
5397
|
}
|
|
5396
|
-
return { ...command, env };
|
|
5398
|
+
return { ...command, env, ...envPaths.size ? { envPaths: [...envPaths] } : {} };
|
|
5397
5399
|
}
|
|
5398
5400
|
async function packages(fs, modules) {
|
|
5399
5401
|
const names2 = await fs.readdir(modules).catch(() => []);
|
|
@@ -5588,7 +5590,7 @@ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, ke
|
|
|
5588
5590
|
);
|
|
5589
5591
|
const take = async (tier) => {
|
|
5590
5592
|
for (const [name2, { pkg, command }] of winners(tier)) {
|
|
5591
|
-
if (!found.has(name2)) found.set(name2, await withPackagePaths(fs, pkg, command));
|
|
5593
|
+
if (!found.has(name2)) found.set(name2, await withPackagePaths(fs, pkg, command, provenance));
|
|
5592
5594
|
}
|
|
5593
5595
|
};
|
|
5594
5596
|
const dependencies = [];
|
|
@@ -18705,6 +18707,7 @@ var SudoReads = class {
|
|
|
18705
18707
|
documents = /* @__PURE__ */ new Map();
|
|
18706
18708
|
texts = /* @__PURE__ */ new Map();
|
|
18707
18709
|
relevant = /* @__PURE__ */ new Set();
|
|
18710
|
+
envPaths = /* @__PURE__ */ new Set();
|
|
18708
18711
|
verified = /* @__PURE__ */ new Set();
|
|
18709
18712
|
interpreters = [];
|
|
18710
18713
|
chainSha256;
|
|
@@ -18724,11 +18727,13 @@ var SudoReads = class {
|
|
|
18724
18727
|
}
|
|
18725
18728
|
resetSelection() {
|
|
18726
18729
|
this.relevant.clear();
|
|
18730
|
+
this.envPaths.clear();
|
|
18727
18731
|
this.interpreters.length = 0;
|
|
18728
18732
|
delete this.chainSha256;
|
|
18729
18733
|
this.operandsFromEnd.clear();
|
|
18730
18734
|
}
|
|
18731
|
-
include(paths) {
|
|
18735
|
+
include(paths, envPaths) {
|
|
18736
|
+
for (const path of envPaths ?? []) this.envPaths.add(path);
|
|
18732
18737
|
for (const path of paths ?? []) if (this.verified.has(path)) this.relevant.add(path);
|
|
18733
18738
|
}
|
|
18734
18739
|
async digest(path) {
|
|
@@ -18820,6 +18825,12 @@ var SudoReads = class {
|
|
|
18820
18825
|
...scripts.length ? { scripts } : {},
|
|
18821
18826
|
...this.chainSha256 ? { chainSha256: this.chainSha256 } : {}
|
|
18822
18827
|
};
|
|
18828
|
+
for (const path of this.envPaths) {
|
|
18829
|
+
if (!await this.access.trustedEnvPath(path)) {
|
|
18830
|
+
binding.writableEnvPath = true;
|
|
18831
|
+
break;
|
|
18832
|
+
}
|
|
18833
|
+
}
|
|
18823
18834
|
if (!Object.keys(routes).some((path) => path !== routes[path])) return binding;
|
|
18824
18835
|
const pairs = Object.keys(routes).sort().map((path) => [path, routes[path]]);
|
|
18825
18836
|
const routeSha256 = await sha2562(new TextEncoder().encode(JSON.stringify(pairs)));
|
|
@@ -19911,7 +19922,9 @@ function changedFile(approved, now) {
|
|
|
19911
19922
|
return [...files].find((file) => approved[file] !== now[file]);
|
|
19912
19923
|
}
|
|
19913
19924
|
function pinned(rule2, hashes, proof) {
|
|
19914
|
-
|
|
19925
|
+
if (!rule2.sha256) return true;
|
|
19926
|
+
if (proof.writableEnvPath && !rule2.chainSha256 && !Object.keys(rule2.sha256).length) return false;
|
|
19927
|
+
return rule2.routeSha256 === proof.routeSha256 && (rule2.chainSha256 === void 0 || rule2.chainSha256 === proof.chainSha256) && changedFile(rule2.sha256, hashes) === void 0;
|
|
19915
19928
|
}
|
|
19916
19929
|
function changedManifests(rules, bound3) {
|
|
19917
19930
|
const changed2 = /* @__PURE__ */ new Set();
|
|
@@ -19932,8 +19945,11 @@ function proofOf({ routeSha256, chainSha256 }) {
|
|
|
19932
19945
|
function changedDecision(hashes, proof, now, path) {
|
|
19933
19946
|
return changedFile(hashes, now.hashes) ?? (proof.routeSha256 !== now.routeSha256 || proof.chainSha256 !== now.chainSha256 ? path : void 0);
|
|
19934
19947
|
}
|
|
19948
|
+
function durableProof(files) {
|
|
19949
|
+
return files.writableEnvPath || Object.keys(files.hashes).length ? proofOf(files) : {};
|
|
19950
|
+
}
|
|
19935
19951
|
function stampOf(files) {
|
|
19936
|
-
return
|
|
19952
|
+
return { ...files.hashes, ...durableProof(files) };
|
|
19937
19953
|
}
|
|
19938
19954
|
var REPLAY_ID = /^[!-~]{1,256}$/;
|
|
19939
19955
|
var REPLAY_TAGS_MAX = 64;
|
|
@@ -20390,6 +20406,7 @@ var Sudo = class {
|
|
|
20390
20406
|
{
|
|
20391
20407
|
real: (at) => this.real(at),
|
|
20392
20408
|
trusted: (at) => this.trustedThrough(at, void 0, fs),
|
|
20409
|
+
trustedEnvPath: (at) => this.trusted(at, true),
|
|
20393
20410
|
read: (at) => fs.readFileBuffer(at)
|
|
20394
20411
|
},
|
|
20395
20412
|
snapshots
|
|
@@ -20510,13 +20527,12 @@ ${SCRIPT_HELP}
|
|
|
20510
20527
|
const cred = credOf(self);
|
|
20511
20528
|
const [word = "", ...args] = r.argv;
|
|
20512
20529
|
const argv = [r.path, ...args];
|
|
20513
|
-
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
}
|
|
20530
|
+
const rules = await this.replayRules(self, target, r, argv);
|
|
20531
|
+
const denied2 = () => failed2(
|
|
20532
|
+
"EACCES",
|
|
20533
|
+
`sudo: ${self.name} may no longer ask to run ${r.argv.map(quoteWord).join(" ")} as ${target.name}`
|
|
20534
|
+
);
|
|
20535
|
+
if (rules?.length === 0) return denied2();
|
|
20520
20536
|
if (await this.canonical(r.cwd) !== r.cwd) {
|
|
20521
20537
|
return failed2("EACCES", `sudo: ${r.cwd} changed since it was requested`);
|
|
20522
20538
|
}
|
|
@@ -20545,6 +20561,8 @@ ${SCRIPT_HELP}
|
|
|
20545
20561
|
const hint = missing7.length && changedFile(r.bound, bound3.hashes) === void 0 ? `; the saved request lacks ${missing7.join(" and ")}; pass back the whole request from approve unchanged` : "";
|
|
20546
20562
|
return failed2("EPERM", requestedText(word) + hint);
|
|
20547
20563
|
}
|
|
20564
|
+
if (bound3.writableEnvPath && rules && !rules.some((rule2) => pinned(rule2, bound3.hashes, bound3)))
|
|
20565
|
+
return denied2();
|
|
20548
20566
|
const now = await this.rootOnly(r.cwd, args);
|
|
20549
20567
|
const flipped = Object.keys(r.rootOnly).find((at) => r.rootOnly[at] && now[at] !== true);
|
|
20550
20568
|
if (flipped !== void 0) return failed2("EPERM", `sudo: ${flipped} is no longer root-only`);
|
|
@@ -20565,12 +20583,12 @@ ${SCRIPT_HELP}
|
|
|
20565
20583
|
);
|
|
20566
20584
|
return { grant, caller: self, target, tags: r.tags };
|
|
20567
20585
|
}
|
|
20568
|
-
async
|
|
20569
|
-
if (self.uid === 0) return
|
|
20586
|
+
async replayRules(self, target, r, argv) {
|
|
20587
|
+
if (self.uid === 0) return void 0;
|
|
20570
20588
|
const cred = credOf(self);
|
|
20571
20589
|
const { rules } = await this.policyRules({ cred, pid: 0, stdin: r.stdin });
|
|
20572
20590
|
const applies = await this.applies(self, cred);
|
|
20573
|
-
return rules.
|
|
20591
|
+
return rules.filter(
|
|
20574
20592
|
(rule2) => applies(rule2.who) && (rule2.target === "ALL" || rule2.target === target.name) && (rule2.cwd === void 0 || rule2.cwd === r.cwd) && stdinMatches(rule2, r.stdin) && commandMatches(rule2.cmnd, argv) && pinned(rule2, r.bound, r)
|
|
20575
20593
|
);
|
|
20576
20594
|
}
|
|
@@ -20636,7 +20654,7 @@ ${SCRIPT_HELP}
|
|
|
20636
20654
|
const result = answer2.answer === "once" ? grant() : await this.always(
|
|
20637
20655
|
self,
|
|
20638
20656
|
target,
|
|
20639
|
-
{ cwd, argv, bound: bound3.hashes, ...
|
|
20657
|
+
{ cwd, argv, bound: bound3.hashes, ...durableProof(now) },
|
|
20640
20658
|
shown2,
|
|
20641
20659
|
grant
|
|
20642
20660
|
);
|
|
@@ -38210,7 +38228,7 @@ function expandDefaults(defaults2, env) {
|
|
|
38210
38228
|
return out;
|
|
38211
38229
|
}
|
|
38212
38230
|
function targetOf(command, reads) {
|
|
38213
|
-
reads?.include(command.manifests);
|
|
38231
|
+
reads?.include(command.manifests, command.envPaths);
|
|
38214
38232
|
return {
|
|
38215
38233
|
abi: command.abi,
|
|
38216
38234
|
command: command.name,
|
|
@@ -39078,7 +39096,7 @@ var Launcher = class {
|
|
|
39078
39096
|
const at = direct ? file : await this.followCommand(this.fs.resolvePath(cwd, file), reads, parentHops);
|
|
39079
39097
|
const command = await this.commandAt(at, scope, reads);
|
|
39080
39098
|
if (!command?.script) return void 0;
|
|
39081
|
-
reads?.include(command.manifests);
|
|
39099
|
+
reads?.include(command.manifests, command.envPaths);
|
|
39082
39100
|
return command;
|
|
39083
39101
|
}
|
|
39084
39102
|
async mayRead(reader, path, reads) {
|