@poe-platform/safe-bash 0.1.424 → 0.1.425
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/safe-bash/browser.js +10 -5
- package/dist/safe-bash/browser.js.map +2 -2
- package/dist/safe-bash/commands/network/private-address.d.ts.map +1 -1
- package/dist/safe-bash/commands/network/private-address.js +10 -3
- package/dist/safe-bash/commands/network/private-address.js.map +1 -1
- package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts.map +1 -1
- package/dist/safe-bash/commands/text-programs/awk-runtime.js +9 -2
- package/dist/safe-bash/commands/text-programs/awk-runtime.js.map +1 -1
- package/dist/safe-bash/commands/text-programs/sed.d.ts.map +1 -1
- package/dist/safe-bash/commands/text-programs/sed.js +7 -2
- package/dist/safe-bash/commands/text-programs/sed.js.map +1 -1
- package/dist/safe-bash/commands/text-programs/shared.d.ts +1 -0
- package/dist/safe-bash/commands/text-programs/shared.d.ts.map +1 -1
- package/dist/safe-bash/commands/text-programs/shared.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -270,7 +270,7 @@ For SafeJS host integration, `makeSafeJsShellModule` exposes shell execution and
|
|
|
270
270
|
| --- | --- |
|
|
271
271
|
| `fs` | Required filesystem; no implicit host access. |
|
|
272
272
|
| `cwd` | Initial virtual directory; defaults to `/`. |
|
|
273
|
-
| `env` | Initial exported variables; defaults to an empty map, with `PWD` set from `cwd`. No host environment inheritance. Never pass host `process.env` or any secret-bearing object: everything in `env` is readable by executed scripts (`env`, `printenv`, `$VAR`), and on Cloudflare Workers with `nodejs_compat` `process.env` contains the Worker's secret bindings. The shell
|
|
273
|
+
| `env` | Initial exported variables; defaults to an empty map, with `PWD` set from `cwd`. No host environment inheritance. Never pass host `process.env` or any secret-bearing object: everything in `env` is readable by executed scripts (`env`, `printenv`, `$VAR`), and on Cloudflare Workers with `nodejs_compat` `process.env` contains the Worker's secret bindings. The shell warns only for the identical host `process.env` object, not copies, and does not filter values. |
|
|
274
274
|
| `commands` | Existing `CommandRegistry`; defaults to an empty registry. |
|
|
275
275
|
| `limits` | Resource limits listed below. |
|
|
276
276
|
|
|
@@ -289,7 +289,7 @@ provided. Pass an `AbortSignal` as `signal` to cancel. [Option types](src/shell/
|
|
|
289
289
|
| `maxExpansionFields` | 10,000 |
|
|
290
290
|
| `maxExpansionBytes` | 16 MiB |
|
|
291
291
|
| `maxWallClockMs` | 30 seconds |
|
|
292
|
-
| `maxCpuMs` | 30 seconds,
|
|
292
|
+
| `maxCpuMs` | 30 seconds elapsed including waits; checkpoint-enforced, not CPU accounting or preemptive enforcement. |
|
|
293
293
|
| `pipeHighWaterMark` | 64 KiB |
|
|
294
294
|
|
|
295
295
|
Always call `dispose()` when finished. Shell failures normally produce an exit
|
|
@@ -17941,7 +17941,7 @@ init_platform();
|
|
|
17941
17941
|
// packages/safe-bash/src/commands/network/private-address.ts
|
|
17942
17942
|
init_platform();
|
|
17943
17943
|
function privateIPv4(first, second) {
|
|
17944
|
-
return first === 10 || first === 127 || first === 0 || first === 169 && second === 254 || first === 192 && second === 168 || first === 172 && second >= 16 && second <= 31;
|
|
17944
|
+
return first === 10 || first === 127 || first === 0 || first === 169 && second === 254 || first === 192 && second === 168 || first === 172 && second >= 16 && second <= 31 || first === 100 && second >= 64 && second <= 127 || first === 198 && second >= 18 && second <= 19 || first >= 224;
|
|
17945
17945
|
}
|
|
17946
17946
|
function privateHostname(input3) {
|
|
17947
17947
|
const hostname = input3.toLowerCase().replace(/\.$/u, "").replace(/^\[|\]$/gu, "");
|
|
@@ -17957,10 +17957,12 @@ function privateHostname(input3) {
|
|
|
17957
17957
|
const mappedIPv4 = hextets.slice(0, 5).every((value2) => value2 === 0) && hextets[5] === 65535;
|
|
17958
17958
|
const translatedIPv4 = hextets.slice(0, 4).every((value2) => value2 === 0) && hextets[4] === 65535 && hextets[5] === 0;
|
|
17959
17959
|
const nat64IPv4 = hextets[0] === 100 && hextets[1] === 65435 && hextets.slice(2, 6).every((value2) => value2 === 0);
|
|
17960
|
-
|
|
17960
|
+
const compatibleIPv4 = hextets.slice(0, 6).every((value2) => value2 === 0);
|
|
17961
|
+
if (mappedIPv4 || translatedIPv4 || nat64IPv4 || compatibleIPv4) {
|
|
17961
17962
|
return privateIPv4(hextets[6] >>> 8, hextets[6] & 255);
|
|
17962
17963
|
}
|
|
17963
|
-
|
|
17964
|
+
if (hextets[0] === 8194) return privateIPv4(hextets[1] >>> 8, hextets[1] & 255);
|
|
17965
|
+
return (hextets[0] & 65024) === 64512 || (hextets[0] & 65472) === 65152 || (hextets[0] & 65472) === 65216 || (hextets[0] & 65280) === 65280 || hextets[0] === 100 && hextets[1] === 65435 && hextets[2] === 1;
|
|
17964
17966
|
}
|
|
17965
17967
|
const parts2 = hostname.split(".");
|
|
17966
17968
|
if (parts2.length !== 4 || parts2.some((part) => !part || Array.from(part).some((character) => character < "0" || character > "9"))) return false;
|
|
@@ -19144,7 +19146,7 @@ async function substitute(text, pattern, replacement, budget, global, occurrence
|
|
|
19144
19146
|
}
|
|
19145
19147
|
|
|
19146
19148
|
// packages/safe-bash/src/commands/text-programs/sed.ts
|
|
19147
|
-
function parse(source, extended, separator) {
|
|
19149
|
+
function parse(source, extended, separator, maxProgramInstructions) {
|
|
19148
19150
|
if (source.length > 1024 * 1024) throw new ProgramError("sed program exceeds 1 MiB");
|
|
19149
19151
|
const result = [];
|
|
19150
19152
|
const groups = [];
|
|
@@ -19240,6 +19242,7 @@ function parse(source, extended, separator) {
|
|
|
19240
19242
|
continue;
|
|
19241
19243
|
}
|
|
19242
19244
|
if (offset === source.length) break;
|
|
19245
|
+
if (result.length >= maxProgramInstructions) throw new ProgramError("program instruction limit exceeded");
|
|
19243
19246
|
const first = address();
|
|
19244
19247
|
horizontal();
|
|
19245
19248
|
let second;
|
|
@@ -19629,6 +19632,8 @@ async function execute(program, context, files, quiet, budget, separator, output
|
|
|
19629
19632
|
}
|
|
19630
19633
|
function sedCommand(options3 = {}) {
|
|
19631
19634
|
const definition = command("sed", async (context) => {
|
|
19635
|
+
const maxProgramInstructions = options3.maxProgramInstructions === void 0 ? 1024 : options3.maxProgramInstructions;
|
|
19636
|
+
if (!Number.isSafeInteger(maxProgramInstructions) || maxProgramInstructions < 1) throw new ProgramError("maxProgramInstructions must be a positive safe integer");
|
|
19632
19637
|
const budget = new Budget3(context, options3);
|
|
19633
19638
|
const sources = [];
|
|
19634
19639
|
const files = [];
|
|
@@ -19677,7 +19682,7 @@ function sedCommand(options3 = {}) {
|
|
|
19677
19682
|
sources.push(byteString(files.shift()));
|
|
19678
19683
|
}
|
|
19679
19684
|
if (sources[0]?.startsWith("#n")) quiet = true;
|
|
19680
|
-
const program = parse(sources.join("\n"), extended, separator);
|
|
19685
|
+
const program = parse(sources.join("\n"), extended, separator, maxProgramInstructions);
|
|
19681
19686
|
const outputFiles = program.flatMap((instruction) => instruction.kind !== "r" && instruction.file !== void 0 ? [instruction.file] : []);
|
|
19682
19687
|
await assertPathRequirements(context, sedRequirements, ["script-output"], outputFiles);
|
|
19683
19688
|
if (inPlace !== void 0 || outputFiles.length) {
|