@poe-platform/safe-js 0.1.220 → 0.1.222
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/dist/safe-js/chunks/{chunk-3IUIZXWX.js → chunk-BWMXJOKV.js} +2 -2
- package/dist/safe-js/chunks/{chunk-AYL6LSPV.js → chunk-M7KI5UI3.js} +31 -11
- package/dist/safe-js/chunks/chunk-M7KI5UI3.js.map +7 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-AYL6LSPV.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-3IUIZXWX.js.map → chunk-BWMXJOKV.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-M7KI5UI3.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-BWMXJOKV.js.map
|
|
@@ -8555,6 +8555,11 @@ function captureGuestHeapNode(value, encode) {
|
|
|
8555
8555
|
}
|
|
8556
8556
|
const origin = getClosureOrigin(value);
|
|
8557
8557
|
if (origin === void 0) {
|
|
8558
|
+
if (Array.isArray(value) && Object.values(Object.getOwnPropertyDescriptors(value)).some((descriptor) => !("value" in descriptor) && retainedAccessorClosures(descriptor).length !== Number(descriptor.get !== void 0) + Number(descriptor.set !== void 0))) return void 0;
|
|
8559
|
+
if (Array.isArray(value) && (!Object.isExtensible(value) || hasExplicitSandboxPrototype(value) || Reflect.ownKeys(value).some((key) => {
|
|
8560
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
8561
|
+
return key === "length" ? descriptor.writable !== true : !("value" in descriptor) || !descriptor.enumerable || !descriptor.configurable || !descriptor.writable;
|
|
8562
|
+
}))) return { kind: "guest-array", state: captureObjectState(value, encode) };
|
|
8558
8563
|
if (isLiveCapability(value) || isSandboxClosure(value) || isSandboxBox(value) || isSandboxDate(value) || isSandboxRegex(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxGenerator(value) || isSandboxArguments(value) || isSandboxCollectionIterator(value) || isSandboxRegExpIterator(value)) return void 0;
|
|
8559
8564
|
const prototype = Object.getPrototypeOf(value);
|
|
8560
8565
|
if ((prototype === null || prototype === Object.prototype) && hasGuestObjectState(value))
|
|
@@ -16637,13 +16642,13 @@ async function evaluateTemplateLiteral(node, context) {
|
|
|
16637
16642
|
}
|
|
16638
16643
|
async function evaluateTaggedTemplateExpression(node, context) {
|
|
16639
16644
|
const invokeTag = async (tag2, receiver) => {
|
|
16640
|
-
if (!isSandboxClosure(tag2)) throw new TypeError("Tagged template tag must be a function.");
|
|
16641
16645
|
const call = createCallContinuation(node, tag2, context, receiver);
|
|
16642
16646
|
context = call.context;
|
|
16643
16647
|
const release = retainValues(context.budget, () => [tag2, receiver]);
|
|
16644
16648
|
try {
|
|
16645
16649
|
const values = await evaluateCallArguments(node.quasi.expressions, context, call.state);
|
|
16646
16650
|
if (!values.ok) return values.result;
|
|
16651
|
+
if (!isSandboxClosure(tag2)) throw new TypeError("Tagged template tag must be a function.");
|
|
16647
16652
|
return {
|
|
16648
16653
|
kind: "normal",
|
|
16649
16654
|
hasValue: true,
|
|
@@ -16690,6 +16695,8 @@ function createTaggedTemplateStrings(node, context) {
|
|
|
16690
16695
|
writable: false
|
|
16691
16696
|
});
|
|
16692
16697
|
taggedTemplateRawArrays.set(strings, raw);
|
|
16698
|
+
Object.freeze(raw);
|
|
16699
|
+
Object.freeze(strings);
|
|
16693
16700
|
return strings;
|
|
16694
16701
|
}
|
|
16695
16702
|
async function evaluateArrowFunction(node, context) {
|
|
@@ -22290,9 +22297,9 @@ function absent(value) {
|
|
|
22290
22297
|
const node = record2(value);
|
|
22291
22298
|
return node.kind === "undefined" && Object.keys(node).length === 1;
|
|
22292
22299
|
}
|
|
22293
|
-
function validateGuestHeapNode(raw, heap) {
|
|
22300
|
+
function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
22294
22301
|
const node = record2(raw);
|
|
22295
|
-
if (!["intrinsic", "guest-function", "guest-generator", "scope-frame", "guest-object"].includes(String(node.kind))) return false;
|
|
22302
|
+
if (!["intrinsic", "guest-function", "guest-generator", "scope-frame", "guest-object", "guest-array"].includes(String(node.kind))) return false;
|
|
22296
22303
|
const reference = (value, kinds) => {
|
|
22297
22304
|
const ref = record2(value);
|
|
22298
22305
|
fields(ref, ["kind", "id"]);
|
|
@@ -22342,9 +22349,22 @@ function validateGuestHeapNode(raw, heap) {
|
|
|
22342
22349
|
fields(node, ["kind", "id"], ["state"]);
|
|
22343
22350
|
if (typeof node.id !== "string" || !intrinsicCatalogue().has(node.id)) throw new TypeError("Unknown intrinsic identity.");
|
|
22344
22351
|
if (Object.hasOwn(node, "state")) state(node.state);
|
|
22345
|
-
} else if (node.kind === "guest-object") {
|
|
22352
|
+
} else if (node.kind === "guest-object" || node.kind === "guest-array") {
|
|
22346
22353
|
fields(node, ["kind", "state"]);
|
|
22347
22354
|
state(node.state);
|
|
22355
|
+
if (node.kind === "guest-array") {
|
|
22356
|
+
const properties = array(record2(record2(node.state).properties).properties).map((entry) => array(entry));
|
|
22357
|
+
const length = properties.find((entry) => entry[0] === "length");
|
|
22358
|
+
if (length === void 0) throw new TypeError("Missing guest array length.");
|
|
22359
|
+
const descriptor = record2(length[1]);
|
|
22360
|
+
if (descriptor.kind !== "data" || descriptor.configurable !== false || descriptor.enumerable !== false || integer(descriptor.value) > 4294967295) throw new TypeError("Invalid guest array length.");
|
|
22361
|
+
if (descriptor.value > maxArrayLength) throw new TypeError("Guest array length exceeds allocation limit.");
|
|
22362
|
+
for (const [key] of properties) {
|
|
22363
|
+
if (typeof key !== "string") continue;
|
|
22364
|
+
const index = Number(key);
|
|
22365
|
+
if (Number.isInteger(index) && index >= 0 && index < 4294967295 && String(index) === key && index >= descriptor.value) throw new TypeError("Guest array index exceeds length.");
|
|
22366
|
+
}
|
|
22367
|
+
}
|
|
22348
22368
|
} else if (node.kind === "guest-function") {
|
|
22349
22369
|
fields(node, ["kind", "astNodeId", "scope", "state"], ["name", "environment"]);
|
|
22350
22370
|
if (integer(node.astNodeId) < 1) throw new TypeError("Invalid guest AST identity.");
|
|
@@ -22387,17 +22407,17 @@ function validateGuestHeapNode(raw, heap) {
|
|
|
22387
22407
|
} else if (expression.kind === "array") {
|
|
22388
22408
|
fields(expression, ["kind", "values", "index"]);
|
|
22389
22409
|
integer(expression.index);
|
|
22390
|
-
reference(expression.values, ["array"]);
|
|
22410
|
+
reference(expression.values, ["array", "guest-array"]);
|
|
22391
22411
|
} else if (expression.kind === "call" || expression.kind === "new" || expression.kind === "tagged") {
|
|
22392
22412
|
fields(expression, ["kind", "callee", "thisValue", "args", "index"]);
|
|
22393
22413
|
integer(expression.index);
|
|
22394
|
-
reference(expression.args, ["array"]);
|
|
22414
|
+
reference(expression.args, ["array", "guest-array"]);
|
|
22395
22415
|
} else if (expression.kind === "array-call") {
|
|
22396
22416
|
fields(expression, ["kind", "target", "method", "args", "index"]);
|
|
22397
22417
|
if (typeof expression.method !== "string") throw new TypeError("Invalid array method.");
|
|
22398
22418
|
integer(expression.index);
|
|
22399
|
-
reference(expression.args, ["array"]);
|
|
22400
|
-
reference(expression.target, ["array"]);
|
|
22419
|
+
reference(expression.args, ["array", "guest-array"]);
|
|
22420
|
+
reference(expression.target, ["array", "guest-array"]);
|
|
22401
22421
|
} else throw new TypeError("Invalid expression continuation.");
|
|
22402
22422
|
}
|
|
22403
22423
|
}
|
|
@@ -22660,7 +22680,7 @@ function validateDumpHeap(root, state) {
|
|
|
22660
22680
|
validateErrorType(entry, path);
|
|
22661
22681
|
validateSymbolEntries(entry, path, state, heap);
|
|
22662
22682
|
try {
|
|
22663
|
-
if (validateGuestHeapNode(entry, heap)) {
|
|
22683
|
+
if (validateGuestHeapNode(entry, heap, state.limits.maxEntries)) {
|
|
22664
22684
|
if (root.version !== 2) fail("unsupportedVersion", path, "guest heap records require dump version 2");
|
|
22665
22685
|
continue;
|
|
22666
22686
|
}
|
|
@@ -22889,7 +22909,7 @@ function validateGeneratorShape(record3, path, state) {
|
|
|
22889
22909
|
function validateHeapValue(value, path, state, heap) {
|
|
22890
22910
|
const record3 = requireRecord(value, path);
|
|
22891
22911
|
try {
|
|
22892
|
-
if (validateGuestHeapNode(record3, heap)) {
|
|
22912
|
+
if (validateGuestHeapNode(record3, heap, state.limits.maxEntries)) {
|
|
22893
22913
|
const tagged = state.validateTaggedPayloads;
|
|
22894
22914
|
state.validateTaggedPayloads = false;
|
|
22895
22915
|
try {
|
|
@@ -38762,4 +38782,4 @@ export {
|
|
|
38762
38782
|
FileSnapshotBackend,
|
|
38763
38783
|
run
|
|
38764
38784
|
};
|
|
38765
|
-
//# sourceMappingURL=chunk-
|
|
38785
|
+
//# sourceMappingURL=chunk-M7KI5UI3.js.map
|