@ai-ecoverse/slicc-kernel 1.173.1 → 1.173.3
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/index.js +11 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +68 -12
- 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 +68 -12
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/node.d.ts +1 -1
- package/dist/types/sudo.d.ts +5 -1
- package/package.json +2 -2
package/dist/kernel-worker.js
CHANGED
|
@@ -8740,7 +8740,7 @@ function satisfies(version, range2) {
|
|
|
8740
8740
|
}
|
|
8741
8741
|
|
|
8742
8742
|
// src/version.ts
|
|
8743
|
-
var KERNEL_VERSION = true ? "1.173.
|
|
8743
|
+
var KERNEL_VERSION = true ? "1.173.3" : "0.0.0-dev";
|
|
8744
8744
|
var OS_RELEASE = "6.0.0-slicc";
|
|
8745
8745
|
function procVersion() {
|
|
8746
8746
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -31749,10 +31749,66 @@ var RULE = new RegExp(
|
|
|
31749
31749
|
);
|
|
31750
31750
|
var TERM = /^[A-Za-z0-9._+-]+$/;
|
|
31751
31751
|
var PLAIN3 = /^[A-Za-z0-9_@%+=:,./-]+$/;
|
|
31752
|
+
var CONTROL = /[\0-\x1f\x7f]/;
|
|
31752
31753
|
var USAGE = "usage: sudo [-n] [-u user] [--] command [args...]\n sudo -l";
|
|
31754
|
+
var DENIED2 = "sudo: approval denied";
|
|
31755
|
+
var DENIAL_MAX = 500;
|
|
31756
|
+
var ABORTED = /* @__PURE__ */ Symbol("aborted");
|
|
31757
|
+
function hasControl(text) {
|
|
31758
|
+
return CONTROL.test(text);
|
|
31759
|
+
}
|
|
31760
|
+
function withoutControl(text) {
|
|
31761
|
+
return text.replace(CONTROL, (ch) => {
|
|
31762
|
+
const n = ch.charCodeAt(0);
|
|
31763
|
+
if (n === 9) return "\\t";
|
|
31764
|
+
if (n === 10) return "\\n";
|
|
31765
|
+
if (n === 13) return "\\r";
|
|
31766
|
+
return `\\x${n.toString(16).padStart(2, "0")}`;
|
|
31767
|
+
});
|
|
31768
|
+
}
|
|
31753
31769
|
function failed3(errno3, error) {
|
|
31754
31770
|
return { error, errno: errno3 };
|
|
31755
31771
|
}
|
|
31772
|
+
function denialText(answer2) {
|
|
31773
|
+
try {
|
|
31774
|
+
if (typeof answer2 !== "object" || answer2 === null) return DENIED2;
|
|
31775
|
+
const { answer: kind, message: message3 } = answer2;
|
|
31776
|
+
if (kind !== "deny" || typeof message3 !== "string") return DENIED2;
|
|
31777
|
+
const chars = [
|
|
31778
|
+
...message3.replace(/[\t\n\v\f\r\u0085\u2028\u2029]+/g, " ").replace(/\p{Cc}/gu, "").trimEnd()
|
|
31779
|
+
];
|
|
31780
|
+
const text = chars.length > DENIAL_MAX ? `${chars.slice(0, DENIAL_MAX - 1).join("")}\u2026` : chars.join("");
|
|
31781
|
+
return text.startsWith("sudo: ") && text.slice(6).trim() !== "" ? text : DENIED2;
|
|
31782
|
+
} catch {
|
|
31783
|
+
return DENIED2;
|
|
31784
|
+
}
|
|
31785
|
+
}
|
|
31786
|
+
async function answerOf2(approve, req, signal) {
|
|
31787
|
+
let reply;
|
|
31788
|
+
let cut;
|
|
31789
|
+
const snapshot = () => reply === void 0 ? Promise.resolve(ABORTED) : Promise.race([reply, Promise.resolve(ABORTED)]).catch(() => "deny");
|
|
31790
|
+
const aborted3 = new Promise(
|
|
31791
|
+
(resolve2) => signal.addEventListener(
|
|
31792
|
+
"abort",
|
|
31793
|
+
() => {
|
|
31794
|
+
cut = snapshot();
|
|
31795
|
+
resolve2();
|
|
31796
|
+
},
|
|
31797
|
+
{ once: true }
|
|
31798
|
+
)
|
|
31799
|
+
);
|
|
31800
|
+
try {
|
|
31801
|
+
reply = Promise.resolve(approve(req, { signal }));
|
|
31802
|
+
} catch {
|
|
31803
|
+
reply = Promise.resolve("deny");
|
|
31804
|
+
}
|
|
31805
|
+
try {
|
|
31806
|
+
const answer2 = await Promise.race([reply, aborted3]);
|
|
31807
|
+
return cut === void 0 ? answer2 : await cut;
|
|
31808
|
+
} catch {
|
|
31809
|
+
return cut === void 0 ? "deny" : await cut;
|
|
31810
|
+
}
|
|
31811
|
+
}
|
|
31756
31812
|
function unescaped(double) {
|
|
31757
31813
|
return double.replace(/\\(["\\$`])/g, "$1");
|
|
31758
31814
|
}
|
|
@@ -31775,7 +31831,8 @@ function splitWords(text) {
|
|
|
31775
31831
|
return words2;
|
|
31776
31832
|
}
|
|
31777
31833
|
function quoteWord(word) {
|
|
31778
|
-
|
|
31834
|
+
const text = hasControl(word) ? withoutControl(word) : word;
|
|
31835
|
+
return PLAIN3.test(text) ? text : `'${text.replaceAll("'", `'\\''`)}'`;
|
|
31779
31836
|
}
|
|
31780
31837
|
function addPart(word, part) {
|
|
31781
31838
|
const last = word.length - 1;
|
|
@@ -31911,7 +31968,7 @@ function recordedBare(line, file, rule) {
|
|
|
31911
31968
|
const head = `NOPASSWD ${rule.who} (${rule.target}) `;
|
|
31912
31969
|
const cmnd = `Cmnd ${quoteWord(rule.cmnd.path)}`;
|
|
31913
31970
|
const cwd = rule.cwd === void 0 ? "" : `Cwd ${quoteWord(rule.cwd)} `;
|
|
31914
|
-
return line === `${head}${cwd}${cmnd}`;
|
|
31971
|
+
return line.trimEnd() === `${head}${cwd}${cmnd}`;
|
|
31915
31972
|
}
|
|
31916
31973
|
function flags(parsed2, arg, next3) {
|
|
31917
31974
|
for (let j = 1; j < arg.length; j++) {
|
|
@@ -32142,7 +32199,7 @@ ${lines2}
|
|
|
32142
32199
|
}
|
|
32143
32200
|
async ask(caller, self, target, argv, path, cwd, requester) {
|
|
32144
32201
|
const { approve } = this.o;
|
|
32145
|
-
if (!approve || requester.aborted) return failed3("EACCES",
|
|
32202
|
+
if (!approve || requester.aborted) return failed3("EACCES", DENIED2);
|
|
32146
32203
|
const createdAt = Date.now();
|
|
32147
32204
|
const timeout = this.o.timeoutMs ?? SUDO_TIMEOUT_MS;
|
|
32148
32205
|
const req = {
|
|
@@ -32165,16 +32222,14 @@ ${lines2}
|
|
|
32165
32222
|
const timer = setTimeout(() => control.abort("expired"), timeout);
|
|
32166
32223
|
const withdraw = () => control.abort("withdrawn");
|
|
32167
32224
|
requester.addEventListener("abort", withdraw, { once: true });
|
|
32168
|
-
const
|
|
32169
|
-
(resolve2) => control.signal.addEventListener("abort", () => resolve2("aborted"), { once: true })
|
|
32170
|
-
);
|
|
32225
|
+
const ended = () => control.signal.reason === "expired" ? failed3("ETIMEDOUT", "sudo: the request expired") : failed3("EINTR", "sudo: the request was withdrawn");
|
|
32171
32226
|
try {
|
|
32172
|
-
const
|
|
32173
|
-
|
|
32174
|
-
if (answer2 === "
|
|
32175
|
-
return control.signal.
|
|
32227
|
+
const answer2 = await answerOf2(approve, req, control.signal);
|
|
32228
|
+
if (answer2 === ABORTED) return ended();
|
|
32229
|
+
if (answer2 === "once" || answer2 === "always") {
|
|
32230
|
+
return control.signal.aborted ? ended() : answer2;
|
|
32176
32231
|
}
|
|
32177
|
-
return
|
|
32232
|
+
return failed3("EACCES", denialText(answer2));
|
|
32178
32233
|
} finally {
|
|
32179
32234
|
clearTimeout(timer);
|
|
32180
32235
|
requester.removeEventListener("abort", withdraw);
|
|
@@ -32184,6 +32239,7 @@ ${lines2}
|
|
|
32184
32239
|
const { fs } = this.o;
|
|
32185
32240
|
const path = `${SUDOERS_D}/${self.name}`;
|
|
32186
32241
|
if (!NAME3.test(self.name)) return false;
|
|
32242
|
+
if (hasControl(cwd) || argv.some(hasControl)) return false;
|
|
32187
32243
|
try {
|
|
32188
32244
|
await this.provision();
|
|
32189
32245
|
if (!await this.trusted(SUDOERS_D)) return false;
|