unpeek 4.2.0 → 4.3.0
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/README.tr.md +2 -2
- package/dist/adapters/esbuild.cjs +5 -5
- package/dist/adapters/esbuild.js +3 -3
- package/dist/adapters/next/adapter.cjs +5 -5
- package/dist/adapters/next/adapter.js +4 -4
- package/dist/adapters/next/index.cjs +5 -5
- package/dist/adapters/next/index.js +4 -4
- package/dist/adapters/rollup.cjs +5 -5
- package/dist/adapters/rollup.js +3 -3
- package/dist/adapters/rspack.cjs +5 -5
- package/dist/adapters/rspack.js +3 -3
- package/dist/adapters/vite.cjs +5 -5
- package/dist/adapters/vite.js +3 -3
- package/dist/adapters/webpack.cjs +5 -5
- package/dist/adapters/webpack.js +3 -3
- package/dist/browser.cjs +2 -2
- package/dist/browser.js +1 -1
- package/dist/{chunk-UUJLTW7O.cjs → chunk-4IRIMLT3.cjs} +16 -16
- package/dist/{chunk-AD6UFBPA.cjs → chunk-4XSFPX2Z.cjs} +367 -8
- package/dist/{chunk-KIAYVIC5.cjs → chunk-7F75S3GQ.cjs} +60 -36
- package/dist/{chunk-K77WRITN.js → chunk-EASD7C2B.js} +3 -3
- package/dist/{chunk-APQOBFRO.js → chunk-GKWTP4Z5.js} +30 -6
- package/dist/{chunk-MSECP2P4.cjs → chunk-OR5M3SN2.cjs} +1199 -428
- package/dist/{chunk-32GLSJAW.js → chunk-RDP4MTHK.js} +359 -0
- package/dist/{chunk-BL2UXZGD.js → chunk-RM3V7KJA.js} +1040 -269
- package/dist/{chunk-SJK45WAU.cjs → chunk-SBRU7GSX.cjs} +8 -8
- package/dist/{chunk-GCWXTWTN.js → chunk-XEYMZUP5.js} +2 -2
- package/dist/cli/index.js +1425 -274
- package/dist/index.cjs +21 -21
- package/dist/index.js +3 -3
- package/dist/plugins/unplugin.cjs +4 -4
- package/dist/plugins/unplugin.js +3 -3
- package/package.json +1 -1
|
@@ -2815,8 +2815,119 @@ var compactGenerator = Object.assign({}, baseGenerator, {
|
|
|
2815
2815
|
this[node.options.type](node.options, state);
|
|
2816
2816
|
}
|
|
2817
2817
|
state.write(")");
|
|
2818
|
+
},
|
|
2819
|
+
ImportSpecifier(node, state) {
|
|
2820
|
+
writeModuleBindingName(this, node.imported, state);
|
|
2821
|
+
const sameIdent = node.imported?.type === "Identifier" && node.local?.type === "Identifier" && node.imported.name === node.local.name;
|
|
2822
|
+
if (!sameIdent && node.local?.name) {
|
|
2823
|
+
state.write(" as " + node.local.name);
|
|
2824
|
+
}
|
|
2825
|
+
},
|
|
2826
|
+
ExportSpecifier(node, state) {
|
|
2827
|
+
writeModuleBindingName(this, node.local, state);
|
|
2828
|
+
const sameIdent = node.local?.type === "Identifier" && node.exported?.type === "Identifier" && node.local.name === node.exported.name;
|
|
2829
|
+
if (!sameIdent && node.exported) {
|
|
2830
|
+
state.write(" as ");
|
|
2831
|
+
writeModuleBindingName(this, node.exported, state);
|
|
2832
|
+
}
|
|
2833
|
+
},
|
|
2834
|
+
ImportDeclaration(node, state) {
|
|
2835
|
+
state.write("import ");
|
|
2836
|
+
const specifiers = node.specifiers || [];
|
|
2837
|
+
const len = specifiers.length;
|
|
2838
|
+
let i = 0;
|
|
2839
|
+
if (len > 0) {
|
|
2840
|
+
while (i < len) {
|
|
2841
|
+
if (i > 0) state.write(", ");
|
|
2842
|
+
const spec = specifiers[i];
|
|
2843
|
+
const tag = spec.type[6];
|
|
2844
|
+
if (tag === "D") {
|
|
2845
|
+
state.write(spec.local.name, spec);
|
|
2846
|
+
i++;
|
|
2847
|
+
} else if (tag === "N") {
|
|
2848
|
+
state.write("* as " + spec.local.name, spec);
|
|
2849
|
+
i++;
|
|
2850
|
+
} else {
|
|
2851
|
+
break;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
if (i < len) {
|
|
2855
|
+
state.write("{");
|
|
2856
|
+
for (; ; ) {
|
|
2857
|
+
this.ImportSpecifier(specifiers[i], state);
|
|
2858
|
+
if (++i < len) {
|
|
2859
|
+
state.write(", ");
|
|
2860
|
+
} else {
|
|
2861
|
+
break;
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
state.write("}");
|
|
2865
|
+
}
|
|
2866
|
+
state.write(" from ");
|
|
2867
|
+
}
|
|
2868
|
+
this.Literal(node.source, state);
|
|
2869
|
+
writeImportAttributes(this, node.attributes, state);
|
|
2870
|
+
state.write(";");
|
|
2871
|
+
},
|
|
2872
|
+
ExportNamedDeclaration(node, state) {
|
|
2873
|
+
state.write("export ");
|
|
2874
|
+
if (node.declaration) {
|
|
2875
|
+
this[node.declaration.type](node.declaration, state);
|
|
2876
|
+
return;
|
|
2877
|
+
}
|
|
2878
|
+
state.write("{");
|
|
2879
|
+
const specifiers = node.specifiers || [];
|
|
2880
|
+
const len = specifiers.length;
|
|
2881
|
+
if (len > 0) {
|
|
2882
|
+
for (let i = 0; ; ) {
|
|
2883
|
+
this.ExportSpecifier(specifiers[i], state);
|
|
2884
|
+
if (++i < len) {
|
|
2885
|
+
state.write(", ");
|
|
2886
|
+
} else {
|
|
2887
|
+
break;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
state.write("}");
|
|
2892
|
+
if (node.source) {
|
|
2893
|
+
state.write(" from ");
|
|
2894
|
+
this.Literal(node.source, state);
|
|
2895
|
+
}
|
|
2896
|
+
writeImportAttributes(this, node.attributes, state);
|
|
2897
|
+
state.write(";");
|
|
2898
|
+
},
|
|
2899
|
+
ExportAllDeclaration(node, state) {
|
|
2900
|
+
if (node.exported == null) {
|
|
2901
|
+
state.write("export * from ");
|
|
2902
|
+
} else {
|
|
2903
|
+
state.write("export * as ");
|
|
2904
|
+
writeModuleBindingName(this, node.exported, state);
|
|
2905
|
+
state.write(" from ");
|
|
2906
|
+
}
|
|
2907
|
+
this.Literal(node.source, state);
|
|
2908
|
+
writeImportAttributes(this, node.attributes, state);
|
|
2909
|
+
state.write(";");
|
|
2818
2910
|
}
|
|
2819
2911
|
});
|
|
2912
|
+
function writeModuleBindingName(generator, node, state) {
|
|
2913
|
+
if (!node) return;
|
|
2914
|
+
if (node.type === "Literal") {
|
|
2915
|
+
generator.Literal(node, state);
|
|
2916
|
+
} else {
|
|
2917
|
+
state.write(node.name, node);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
function writeImportAttributes(generator, attributes, state) {
|
|
2921
|
+
if (!attributes || attributes.length === 0) return;
|
|
2922
|
+
state.write(" with { ");
|
|
2923
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
2924
|
+
generator.ImportAttribute(attributes[i], state);
|
|
2925
|
+
if (i < attributes.length - 1) {
|
|
2926
|
+
state.write(", ");
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
state.write(" }");
|
|
2930
|
+
}
|
|
2820
2931
|
var VLQ_BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2821
2932
|
function encodeVlq2(value) {
|
|
2822
2933
|
let vlq = value < 0 ? (-value << 1) + 1 : value << 1;
|
|
@@ -3828,7 +3939,8 @@ function injectWasmVault(ast, seed = 2654435769) {
|
|
|
3828
3939
|
const mChars = [105 ^ strKey, 109 ^ strKey, 117 ^ strKey, 108 ^ strKey].join(",");
|
|
3829
3940
|
const helperSnippet = `var ${kdfFnName};
|
|
3830
3941
|
(function(){
|
|
3831
|
-
var _G = typeof globalThis < 'u' ? globalThis : typeof self < 'u' ? self : 0;
|
|
3942
|
+
var _G = typeof globalThis < 'u' ? globalThis : typeof self < 'u' ? self : typeof window < 'u' ? window : 0;
|
|
3943
|
+
var _M = (_G && _G.Math) || Math;
|
|
3832
3944
|
var _reg = _G ? (_G.__unpeek_wasm_kdf || (_G.__unpeek_wasm_kdf = {})) : 0;
|
|
3833
3945
|
if (_reg && _reg['${suffix}']) {
|
|
3834
3946
|
${kdfFnName} = _reg['${suffix}'];
|
|
@@ -3836,10 +3948,10 @@ function injectWasmVault(ast, seed = 2654435769) {
|
|
|
3836
3948
|
}
|
|
3837
3949
|
var _g = [${gArr.join(",")}];
|
|
3838
3950
|
var _evR = function(x) {
|
|
3839
|
-
return (${rA0} +
|
|
3951
|
+
return (${rA0} + _M.imul(x, (${rA1} + _M.imul(x, (${rA2} + _M.imul(${rA3}, x)) | 0)) | 0)) | 0;
|
|
3840
3952
|
};
|
|
3841
3953
|
var _sb = function(b) {
|
|
3842
|
-
return (
|
|
3954
|
+
return (_M.imul(167, b & 255) + ${sOff}) & 255;
|
|
3843
3955
|
};
|
|
3844
3956
|
var _tk = ['__','unp','eek_t','ampered'].join('');
|
|
3845
3957
|
var _eG = function(sl) {
|
|
@@ -3866,7 +3978,7 @@ function injectWasmVault(ast, seed = 2654435769) {
|
|
|
3866
3978
|
for (var _i = 0; _i < _c.length; _i++) {
|
|
3867
3979
|
_p += String.fromCharCode(_c[_i] ^ ${strKey});
|
|
3868
3980
|
}
|
|
3869
|
-
var _m =
|
|
3981
|
+
var _m = _M[_p];
|
|
3870
3982
|
${kdfFnName} = function(f, s, h) {
|
|
3871
3983
|
var _x = (f ^ _k[2] ^ _k[3] ^ (_eG(0) ^ ${gMask})) | 0;
|
|
3872
3984
|
_x = (_x ^ (_x >>> 16)) | 0;
|
|
@@ -4013,6 +4125,61 @@ function unwrapAssignedHostMember(node, matcher, depth = 0) {
|
|
|
4013
4125
|
return false;
|
|
4014
4126
|
}
|
|
4015
4127
|
}
|
|
4128
|
+
function isImportMetaMember(node, propName) {
|
|
4129
|
+
if (!node || node.type !== "MemberExpression") return false;
|
|
4130
|
+
const obj = node.object;
|
|
4131
|
+
if (obj?.type !== "MetaProperty" || obj.meta?.type !== "Identifier" || obj.meta.name !== "import" || obj.property?.type !== "Identifier" || obj.property.name !== "meta") {
|
|
4132
|
+
return false;
|
|
4133
|
+
}
|
|
4134
|
+
if (!node.computed && node.property?.type === "Identifier") {
|
|
4135
|
+
return node.property.name === propName;
|
|
4136
|
+
}
|
|
4137
|
+
return node.computed && node.property?.type === "Literal" && node.property.value === propName;
|
|
4138
|
+
}
|
|
4139
|
+
function isRequireResolveCallee(callee) {
|
|
4140
|
+
if (!callee || callee.type !== "MemberExpression") return false;
|
|
4141
|
+
if (callee.object?.type !== "Identifier" || callee.object.name !== "require") {
|
|
4142
|
+
return false;
|
|
4143
|
+
}
|
|
4144
|
+
if (!callee.computed && callee.property?.type === "Identifier") {
|
|
4145
|
+
return callee.property.name === "resolve";
|
|
4146
|
+
}
|
|
4147
|
+
return callee.computed && callee.property?.type === "Literal" && callee.property.value === "resolve";
|
|
4148
|
+
}
|
|
4149
|
+
function isStaticModuleOrAssetPosition(node, parent) {
|
|
4150
|
+
if (!node || !parent) return false;
|
|
4151
|
+
if (parent.type === "ImportDeclaration" || parent.type === "ExportNamedDeclaration") {
|
|
4152
|
+
return parent.source === node;
|
|
4153
|
+
}
|
|
4154
|
+
if (parent.type === "ExportAllDeclaration") {
|
|
4155
|
+
return parent.source === node || parent.exported === node;
|
|
4156
|
+
}
|
|
4157
|
+
if (parent.type === "ImportExpression") {
|
|
4158
|
+
return parent.source === node;
|
|
4159
|
+
}
|
|
4160
|
+
if (parent.type === "ImportSpecifier") {
|
|
4161
|
+
return parent.imported === node;
|
|
4162
|
+
}
|
|
4163
|
+
if (parent.type === "ExportSpecifier") {
|
|
4164
|
+
return parent.local === node || parent.exported === node;
|
|
4165
|
+
}
|
|
4166
|
+
if (parent.type === "ImportAttribute") {
|
|
4167
|
+
return true;
|
|
4168
|
+
}
|
|
4169
|
+
if (parent.type === "NewExpression") {
|
|
4170
|
+
return parent.callee?.type === "Identifier" && parent.callee.name === "URL" && Array.isArray(parent.arguments) && parent.arguments.length >= 2 && parent.arguments[0] === node && isImportMetaMember(parent.arguments[1], "url");
|
|
4171
|
+
}
|
|
4172
|
+
if (parent.type === "CallExpression") {
|
|
4173
|
+
if (!Array.isArray(parent.arguments) || parent.arguments[0] !== node) {
|
|
4174
|
+
return false;
|
|
4175
|
+
}
|
|
4176
|
+
const callee = parent.callee;
|
|
4177
|
+
if (isImportMetaMember(callee, "resolve")) return true;
|
|
4178
|
+
if (isRequireResolveCallee(callee)) return true;
|
|
4179
|
+
if (callee?.type === "Identifier" && callee.name === "require") return true;
|
|
4180
|
+
}
|
|
4181
|
+
return false;
|
|
4182
|
+
}
|
|
4016
4183
|
function classifyChunkBoundary(ast) {
|
|
4017
4184
|
const exemptSubtreeRoots = /* @__PURE__ */ new WeakSet();
|
|
4018
4185
|
const importSourceNodes = /* @__PURE__ */ new WeakSet();
|
|
@@ -4022,6 +4189,10 @@ function classifyChunkBoundary(ast) {
|
|
|
4022
4189
|
let hasPreloadManifest = false;
|
|
4023
4190
|
walk2.simple(ast, {
|
|
4024
4191
|
CallExpression(node) {
|
|
4192
|
+
const firstArg = Array.isArray(node.arguments) ? node.arguments[0] : void 0;
|
|
4193
|
+
if (firstArg && (firstArg.type === "Literal" || firstArg.type === "TemplateLiteral") && isStaticModuleOrAssetPosition(firstArg, node)) {
|
|
4194
|
+
exemptSubtreeRoots.add(firstArg);
|
|
4195
|
+
}
|
|
4025
4196
|
const callee = node.callee;
|
|
4026
4197
|
const isPushCall = callee?.type === "MemberExpression" && (!callee.computed && callee.property?.type === "Identifier" && callee.property.name === "push" || callee.computed && callee.property?.type === "Literal" && callee.property.value === "push");
|
|
4027
4198
|
if (isPushCall) {
|
|
@@ -4085,6 +4256,49 @@ function classifyChunkBoundary(ast) {
|
|
|
4085
4256
|
exemptSubtreeRoots.add(node);
|
|
4086
4257
|
}
|
|
4087
4258
|
},
|
|
4259
|
+
NewExpression(node) {
|
|
4260
|
+
const firstArg = Array.isArray(node.arguments) ? node.arguments[0] : void 0;
|
|
4261
|
+
if (firstArg && (firstArg.type === "Literal" || firstArg.type === "TemplateLiteral") && isStaticModuleOrAssetPosition(firstArg, node)) {
|
|
4262
|
+
exemptSubtreeRoots.add(firstArg);
|
|
4263
|
+
}
|
|
4264
|
+
},
|
|
4265
|
+
ImportDeclaration(node) {
|
|
4266
|
+
if (node.source && typeof node.source === "object") {
|
|
4267
|
+
exemptSubtreeRoots.add(node.source);
|
|
4268
|
+
}
|
|
4269
|
+
if (Array.isArray(node.specifiers)) {
|
|
4270
|
+
for (const spec of node.specifiers) {
|
|
4271
|
+
if (spec?.type === "ImportSpecifier" && spec.imported?.type === "Literal") {
|
|
4272
|
+
exemptSubtreeRoots.add(spec.imported);
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
},
|
|
4277
|
+
ExportNamedDeclaration(node) {
|
|
4278
|
+
if (node.source && typeof node.source === "object") {
|
|
4279
|
+
exemptSubtreeRoots.add(node.source);
|
|
4280
|
+
}
|
|
4281
|
+
if (Array.isArray(node.specifiers)) {
|
|
4282
|
+
for (const spec of node.specifiers) {
|
|
4283
|
+
if (spec?.type === "ExportSpecifier") {
|
|
4284
|
+
if (spec.local?.type === "Literal") {
|
|
4285
|
+
exemptSubtreeRoots.add(spec.local);
|
|
4286
|
+
}
|
|
4287
|
+
if (spec.exported?.type === "Literal") {
|
|
4288
|
+
exemptSubtreeRoots.add(spec.exported);
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
},
|
|
4294
|
+
ExportAllDeclaration(node) {
|
|
4295
|
+
if (node.source && typeof node.source === "object") {
|
|
4296
|
+
exemptSubtreeRoots.add(node.source);
|
|
4297
|
+
}
|
|
4298
|
+
if (node.exported && typeof node.exported === "object") {
|
|
4299
|
+
exemptSubtreeRoots.add(node.exported);
|
|
4300
|
+
}
|
|
4301
|
+
},
|
|
4088
4302
|
ImportExpression(node) {
|
|
4089
4303
|
importExpressions.push(node);
|
|
4090
4304
|
if (node.source && typeof node.source === "object") {
|
|
@@ -4154,22 +4368,36 @@ function buildRivestDeltaExpr(seed, expectedDelta, varName = "_ed") {
|
|
|
4154
4368
|
const xMasked = xEnc ^ xMask | 0;
|
|
4155
4369
|
return `var _rx=(${xMasked}^${xMask | 0})|0,${varName}=(${rA0}+Math.imul(_rx,(${rA1}+Math.imul(_rx,(${rA2}+Math.imul(${rA3},_rx))|0))|0))&65535;`;
|
|
4156
4370
|
}
|
|
4157
|
-
function
|
|
4371
|
+
function buildLatchInitSnippet(seed, latchCoupling) {
|
|
4372
|
+
if (!latchCoupling || typeof latchCoupling.latchFnName !== "string" || !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(latchCoupling.latchFnName)) {
|
|
4373
|
+
return { hasLatch: false, latchDecl: "" };
|
|
4374
|
+
}
|
|
4375
|
+
const tamperByte = seed >>> 8 & 127 | 53;
|
|
4376
|
+
const expectedLatch = latchCoupling.expectedLatchByte & 255;
|
|
4377
|
+
return {
|
|
4378
|
+
hasLatch: true,
|
|
4379
|
+
latchDecl: `var _ld=typeof ${latchCoupling.latchFnName}==="function"?((${latchCoupling.latchFnName}()^${expectedLatch})&255):${tamperByte};`
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
function createSaltedDecryptorFnAst(seed, pChars, expectedDelta, windowKeySymbol, safeAlpha = SAFE_ALPHA, shieldCoupled = true, _browserOnly = false, latchCoupling) {
|
|
4158
4383
|
const propAccess = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(windowKeySymbol) ? `.${windowKeySymbol}` : `[${JSON.stringify(windowKeySymbol)}]`;
|
|
4159
4384
|
const stateSym = `${windowKeySymbol}_s`;
|
|
4160
4385
|
const stateAccess = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(stateSym) ? `.${stateSym}` : `[${JSON.stringify(stateSym)}]`;
|
|
4161
4386
|
const flagSym = `${windowKeySymbol}_t`;
|
|
4162
4387
|
const flagAccess = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(flagSym) ? `.${flagSym}` : `[${JSON.stringify(flagSym)}]`;
|
|
4163
4388
|
const tkExpr = `['__','unp','eek_t','ampered'].join('')`;
|
|
4389
|
+
const { hasLatch, latchDecl } = buildLatchInitSnippet(seed, latchCoupling);
|
|
4390
|
+
const charEmit = hasLatch ? `o+=String.fromCharCode((k<0?ch:A[(A.indexOf(P[(k-(t&65535)%92+92)%92])-(t>>>16)%92+92)%92]).charCodeAt(0)^_ld);` : `o+=k<0?ch:A[(A.indexOf(P[(k-(t&65535)%92+92)%92])-(t>>>16)%92+92)%92];`;
|
|
4391
|
+
const cacheGuardSuffix = hasLatch ? "&&!_ld" : "";
|
|
4164
4392
|
let fBody;
|
|
4165
4393
|
if (!shieldCoupled) {
|
|
4166
|
-
fBody = `var m=[],c=Function.prototype.toString.call(f),_tk=${tkExpr};for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var A="${safeAlpha}",P="${pChars}";return function(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||((""._u||a._u||0)!==0);if(!tm&&(i in m))return m[i]
|
|
4394
|
+
fBody = `var m=[],c=Function.prototype.toString.call(f),_tk=${tkExpr};for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var A="${safeAlpha}",P="${pChars}";return function(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||((""._u||a._u||0)!==0);if(!tm&&(i in m))return m[i];` + latchDecl + `var d=tm?(((Math.imul(i+1,0x9e3779b1)^0x5a5b)&65535)|1):0;var q=(h^(""._u||a._u||0)^d)>>>0,p=a[i],o="";if(p)for(var t=q^s^Math.imul(i+1,0x01000193),j=0;j<p.length;j++){t=Math.imul(t^j+1,0x01000193)^0x811c9dc5;var ch=p[j],k=A.indexOf(ch);` + charEmit + `}if(!tm${cacheGuardSuffix})m[i]=o;return o;};`;
|
|
4167
4395
|
} else {
|
|
4168
4396
|
const edInit = buildRivestDeltaExpr(seed, expectedDelta, "_ed");
|
|
4169
4397
|
const hasWindowKey = Boolean(windowKeySymbol);
|
|
4170
4398
|
const brDecl = hasWindowKey ? NARROWED_ASYNC_BR_DECL : "";
|
|
4171
4399
|
const svCheck = hasWindowKey ? `(sv===void 0?!_br:sv!==_ed)` : `(sv!==void 0&&sv!==_ed)`;
|
|
4172
|
-
fBody = `var m=[],c=Function.prototype.toString.call(f),_tk=${tkExpr};for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var A="${safeAlpha}",P="${pChars}";${edInit}return function(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0;` + brDecl + `var sv=G&&G${propAccess}!==void 0?G${propAccess}:w&&w${propAccess}!==void 0?w${propAccess}:void 0;var sr=G&&G${stateAccess}?G${stateAccess}:w&&w${stateAccess}?w${stateAccess}:void 0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||(sr&&sr[0]===2)||((""._u||a._u||0)!==0)||${svCheck};if(!tm&&sv===_ed&&(i in m))return m[i]
|
|
4400
|
+
fBody = `var m=[],c=Function.prototype.toString.call(f),_tk=${tkExpr};for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var A="${safeAlpha}",P="${pChars}";${edInit}return function(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0;` + brDecl + `var sv=G&&G${propAccess}!==void 0?G${propAccess}:w&&w${propAccess}!==void 0?w${propAccess}:void 0;var sr=G&&G${stateAccess}?G${stateAccess}:w&&w${stateAccess}?w${stateAccess}:void 0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||(sr&&sr[0]===2)||((""._u||a._u||0)!==0)||${svCheck};if(!tm&&sv===_ed&&(i in m))return m[i];` + latchDecl + `var d=tm?((_ed^(((Math.imul(i+1,0x9e3779b1)^0x5a5b)&65535)|1))&65535):_ed;var q=(h^(""._u||a._u||0)^d)>>>0,p=a[i],o="";if(p)for(var t=q^s^Math.imul(i+1,0x01000193),j=0;j<p.length;j++){t=Math.imul(t^j+1,0x01000193)^0x811c9dc5;var ch=p[j],k=A.indexOf(ch);` + charEmit + `}if(!tm&&sv===_ed${cacheGuardSuffix})m[i]=o;return o;};`;
|
|
4173
4401
|
}
|
|
4174
4402
|
return acorn3.parse(`(function f(a){${fBody}})`, {
|
|
4175
4403
|
ecmaVersion: "latest",
|
|
@@ -4243,7 +4471,7 @@ function replaceNodeInParent(parent, oldNode, newNode) {
|
|
|
4243
4471
|
}
|
|
4244
4472
|
return false;
|
|
4245
4473
|
}
|
|
4246
|
-
function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, config, windowKeySymbol, expectedDelta, deterrentMode, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots) {
|
|
4474
|
+
function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, config, windowKeySymbol, expectedDelta, deterrentMode, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots, latchCoupling) {
|
|
4247
4475
|
if (isAstAlreadySalted(ast)) {
|
|
4248
4476
|
return {
|
|
4249
4477
|
encryptedStringsCount: 0,
|
|
@@ -4343,86 +4571,89 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
|
|
|
4343
4571
|
pushSaltedTarget(val, node, parent, onReplace ? { onReplace } : void 0);
|
|
4344
4572
|
return true;
|
|
4345
4573
|
}
|
|
4346
|
-
walk3.ancestor(
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
hotExemptNodes,
|
|
4353
|
-
exemptSubtreeRoots,
|
|
4354
|
-
getRegExpShadowedScopes
|
|
4355
|
-
)) {
|
|
4356
|
-
pushSaltedTarget(
|
|
4357
|
-
node.regex.pattern,
|
|
4574
|
+
walk3.ancestor(
|
|
4575
|
+
ast,
|
|
4576
|
+
{
|
|
4577
|
+
Literal(node, _state, ancestors) {
|
|
4578
|
+
if (node.regex) {
|
|
4579
|
+
if (isEligibleSecretRegExp(
|
|
4358
4580
|
node,
|
|
4359
|
-
ancestors
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4581
|
+
ancestors,
|
|
4582
|
+
hotExemptNodes,
|
|
4583
|
+
exemptSubtreeRoots,
|
|
4584
|
+
getRegExpShadowedScopes
|
|
4585
|
+
)) {
|
|
4586
|
+
pushSaltedTarget(
|
|
4587
|
+
node.regex.pattern,
|
|
4588
|
+
node,
|
|
4589
|
+
ancestors[ancestors.length - 2],
|
|
4590
|
+
{
|
|
4591
|
+
replaceMode: "regexp",
|
|
4592
|
+
flags: node.regex.flags ?? ""
|
|
4593
|
+
}
|
|
4594
|
+
);
|
|
4595
|
+
}
|
|
4596
|
+
return;
|
|
4597
|
+
}
|
|
4598
|
+
if (typeof node.value !== "string") return;
|
|
4599
|
+
const val = node.value;
|
|
4600
|
+
if (activeDirectives.has(val)) return;
|
|
4601
|
+
const parent = ancestors[ancestors.length - 2];
|
|
4602
|
+
if (!parent) return;
|
|
4603
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
4604
|
+
return;
|
|
4605
|
+
}
|
|
4606
|
+
if (parent.type === "Property" && parent.key === node && !parent.computed) {
|
|
4607
|
+
if (!isEligibleObjectPropertyKey(val, node, parent, ancestors)) {
|
|
4608
|
+
return;
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
4612
|
+
return;
|
|
4365
4613
|
}
|
|
4366
|
-
return;
|
|
4367
|
-
}
|
|
4368
|
-
if (typeof node.value !== "string") return;
|
|
4369
|
-
const val = node.value;
|
|
4370
|
-
if (activeDirectives.has(val)) return;
|
|
4371
|
-
const parent = ancestors[ancestors.length - 2];
|
|
4372
|
-
if (!parent) return;
|
|
4373
|
-
if ((parent.type === "ImportDeclaration" || parent.type === "ExportNamedDeclaration" || parent.type === "ExportAllDeclaration" || parent.type === "ImportExpression") && parent.source === node) {
|
|
4374
|
-
return;
|
|
4375
|
-
}
|
|
4376
|
-
if (parent.type === "Property" && parent.key === node && !parent.computed) {
|
|
4377
|
-
return;
|
|
4378
|
-
}
|
|
4379
|
-
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
4380
|
-
return;
|
|
4381
|
-
}
|
|
4382
|
-
if (parent.type === "ImportAttribute" || parent.type === "ImportSpecifier" || parent.type === "ExportSpecifier") {
|
|
4383
|
-
return;
|
|
4384
|
-
}
|
|
4385
|
-
processSaltedCandidate(val, node, parent, ancestors);
|
|
4386
|
-
},
|
|
4387
|
-
TemplateLiteral(node, ancestors) {
|
|
4388
|
-
if (!Array.isArray(node.quasis) || node.quasis.length === 0) return;
|
|
4389
|
-
const parent = ancestors[ancestors.length - 2];
|
|
4390
|
-
if (isExemptTemplateLiteral(node, parent)) return;
|
|
4391
|
-
const exprCount = Array.isArray(node.expressions) ? node.expressions.length : 0;
|
|
4392
|
-
if (exprCount === 0) {
|
|
4393
|
-
if (node.quasis.length !== 1) return;
|
|
4394
|
-
const val = node.quasis[0].value.cooked ?? node.quasis[0].value.raw;
|
|
4395
|
-
if (typeof val !== "string" || activeDirectives.has(val)) return;
|
|
4396
4614
|
processSaltedCandidate(val, node, parent, ancestors);
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
return;
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4615
|
+
},
|
|
4616
|
+
TemplateLiteral(node, _state, ancestors) {
|
|
4617
|
+
if (!Array.isArray(node.quasis) || node.quasis.length === 0) return;
|
|
4618
|
+
const parent = ancestors[ancestors.length - 2];
|
|
4619
|
+
if (isExemptTemplateLiteral(node, parent)) return;
|
|
4620
|
+
const exprCount = Array.isArray(node.expressions) ? node.expressions.length : 0;
|
|
4621
|
+
if (exprCount === 0) {
|
|
4622
|
+
if (node.quasis.length !== 1) return;
|
|
4623
|
+
const val = node.quasis[0].value.cooked ?? node.quasis[0].value.raw;
|
|
4624
|
+
if (typeof val !== "string" || activeDirectives.has(val)) return;
|
|
4625
|
+
processSaltedCandidate(val, node, parent, ancestors);
|
|
4626
|
+
return;
|
|
4627
|
+
}
|
|
4628
|
+
if (node.quasis.length !== exprCount + 1) return;
|
|
4629
|
+
if (node.quasis.some((q) => typeof q?.value?.cooked !== "string")) {
|
|
4630
|
+
return;
|
|
4631
|
+
}
|
|
4632
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
4633
|
+
let queuedCount = 0;
|
|
4634
|
+
for (let qIdx = 0; qIdx < node.quasis.length; qIdx++) {
|
|
4635
|
+
const val = node.quasis[qIdx].value.cooked;
|
|
4636
|
+
if (activeDirectives.has(val)) continue;
|
|
4637
|
+
const queued = processSaltedCandidate(
|
|
4638
|
+
val,
|
|
4639
|
+
node,
|
|
4640
|
+
parent,
|
|
4641
|
+
ancestors,
|
|
4642
|
+
(exprAst) => {
|
|
4643
|
+
replacements.set(qIdx, exprAst);
|
|
4644
|
+
}
|
|
4645
|
+
);
|
|
4646
|
+
if (queued) {
|
|
4647
|
+
queuedCount++;
|
|
4415
4648
|
}
|
|
4416
|
-
|
|
4417
|
-
if (
|
|
4418
|
-
|
|
4649
|
+
}
|
|
4650
|
+
if (queuedCount > 0) {
|
|
4651
|
+
interpolatedTemplates.push({ node, replacements });
|
|
4419
4652
|
}
|
|
4420
4653
|
}
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
}
|
|
4425
|
-
});
|
|
4654
|
+
},
|
|
4655
|
+
VAULT_WALK_BASE
|
|
4656
|
+
);
|
|
4426
4657
|
if (targetsToReplace.length === 0 && shaderTargets.length === 0) {
|
|
4427
4658
|
return {
|
|
4428
4659
|
encryptedStringsCount: 0,
|
|
@@ -4461,15 +4692,18 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
|
|
|
4461
4692
|
const flagAccess = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(flagSym) ? `.${flagSym}` : `[${JSON.stringify(flagSym)}]`;
|
|
4462
4693
|
const tkExpr = `['__','unp','eek_t','ampered'].join('')`;
|
|
4463
4694
|
const dkExpr = `['__','unp','eek_d','elta'].join('')`;
|
|
4695
|
+
const { hasLatch, latchDecl } = buildLatchInitSnippet(seed, latchCoupling);
|
|
4696
|
+
const charMaskXor = hasLatch ? "^_ld" : "";
|
|
4697
|
+
const cacheGuardSuffix = hasLatch ? "&&!_ld" : "";
|
|
4464
4698
|
let helperFnSnippet;
|
|
4465
4699
|
if (!shieldCoupled) {
|
|
4466
|
-
helperFnSnippet = `function ${decryptFnName}(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0,_tk=${tkExpr},_dk=${dkExpr};var dv=(G&&G[_dk]!=null?G[_dk]:w&&w[_dk]!=null?w[_dk]:0)|0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||((""._u||0)!==0)||(dv!==0);if(!tm&&${cacheVarName}[i]!==void 0)return ${cacheVarName}[i]
|
|
4700
|
+
helperFnSnippet = `function ${decryptFnName}(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0,_tk=${tkExpr},_dk=${dkExpr};var dv=(G&&G[_dk]!=null?G[_dk]:w&&w[_dk]!=null?w[_dk]:0)|0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||((""._u||0)!==0)||(dv!==0);if(!tm&&${cacheVarName}[i]!==void 0)return ${cacheVarName}[i];` + latchDecl + `if(${dCacheVarName}===void 0){var c=Function.prototype.toString.call(${decryptFnName}),h=0x811c9dc5;for(var l=0;l<c.length;l++)h=Math.imul(h^c.charCodeAt(l),0x01000193)>>>0;${dCacheVarName}=h|0;}var effD=tm?((${dCacheVarName}^(((Math.imul(i+1,0x9e3779b1)^0x5a5b)&65535)|1))|0):${dCacheVarName};var k=${kdfFnName}(i,s,effD);var p=${vaultVarName}[i],o="",rk=k|0;for(var j=0;j<p.length;j++){rk=(Math.imul(rk^(j+1),0x45d9f3b)+0x9e3779b9)|0;o+=String.fromCharCode(p.charCodeAt(j)^(((rk>>>16)&127)|1)${charMaskXor});}if(!tm${cacheGuardSuffix})${cacheVarName}[i]=o;return o;}`;
|
|
4467
4701
|
} else {
|
|
4468
4702
|
const edInit = buildRivestDeltaExpr(seed, (expDelta ?? 0) & 65535, "_ed");
|
|
4469
4703
|
const hasWindowKey = Boolean(sym);
|
|
4470
4704
|
const brDecl = hasWindowKey ? NARROWED_ASYNC_BR_DECL : "";
|
|
4471
4705
|
const svCheck = hasWindowKey ? `(sv===void 0?!_br:sv!==_ed)` : `(sv!==void 0&&sv!==_ed)`;
|
|
4472
|
-
helperFnSnippet = `function ${decryptFnName}(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0,_tk=${tkExpr},_dk=${dkExpr};${edInit}` + brDecl + `var sv=G&&G${propAccess}!==void 0?G${propAccess}:w&&w${propAccess}!==void 0?w${propAccess}:void 0;var sr=G&&G${stateAccess}?G${stateAccess}:w&&w${stateAccess}?w${stateAccess}:void 0;var dv=(G&&G[_dk]!=null?G[_dk]:w&&w[_dk]!=null?w[_dk]:0)|0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||(sr&&sr[0]===2)||((""._u||0)!==0)||(dv!==0)||${svCheck};if(!tm&&sv===_ed&&${cacheVarName}[i]!==void 0)return ${cacheVarName}[i]
|
|
4706
|
+
helperFnSnippet = `function ${decryptFnName}(i,s){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var w=typeof window<"u"?window:typeof self<"u"?self:0,_tk=${tkExpr},_dk=${dkExpr};${edInit}` + brDecl + `var sv=G&&G${propAccess}!==void 0?G${propAccess}:w&&w${propAccess}!==void 0?w${propAccess}:void 0;var sr=G&&G${stateAccess}?G${stateAccess}:w&&w${stateAccess}?w${stateAccess}:void 0;var dv=(G&&G[_dk]!=null?G[_dk]:w&&w[_dk]!=null?w[_dk]:0)|0;var tm=(G&&(G[_tk]===!0||G${flagAccess}===!0))||(w&&(w[_tk]===!0||w${flagAccess}===!0))||(sr&&sr[0]===2)||((""._u||0)!==0)||(dv!==0)||${svCheck};if(!tm&&sv===_ed&&${cacheVarName}[i]!==void 0)return ${cacheVarName}[i];` + latchDecl + `if(${dCacheVarName}===void 0){var c=Function.prototype.toString.call(${decryptFnName}),h=0x811c9dc5;for(var l=0;l<c.length;l++)h=Math.imul(h^c.charCodeAt(l),0x01000193)>>>0;${dCacheVarName}=((h|0)^_ed)|0;}var effD=tm?((${dCacheVarName}^(((Math.imul(i+1,0x9e3779b1)^0x5a5b)&65535)|1))|0):${dCacheVarName};var k=${kdfFnName}(i,s,effD);var p=${vaultVarName}[i],o="",rk=k|0;for(var j=0;j<p.length;j++){rk=(Math.imul(rk^(j+1),0x45d9f3b)+0x9e3779b9)|0;o+=String.fromCharCode(p.charCodeAt(j)^(((rk>>>16)&127)|1)${charMaskXor});}if(!tm&&sv===_ed${cacheGuardSuffix})${cacheVarName}[i]=o;return o;}`;
|
|
4473
4707
|
}
|
|
4474
4708
|
const parsedFn = acorn3.parse(helperFnSnippet, {
|
|
4475
4709
|
ecmaVersion: "latest",
|
|
@@ -4510,6 +4744,9 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
|
|
|
4510
4744
|
createNewRegExpAst(callExpr, target.flags ?? "")
|
|
4511
4745
|
);
|
|
4512
4746
|
} else {
|
|
4747
|
+
if (target.parent?.type === "Property" && target.parent.key === target.node) {
|
|
4748
|
+
target.parent.computed = true;
|
|
4749
|
+
}
|
|
4513
4750
|
replaceNodeInParent(target.parent, target.node, callExpr);
|
|
4514
4751
|
}
|
|
4515
4752
|
}
|
|
@@ -4882,13 +5119,10 @@ function isEligibleHotLiteral(val, node, parent, ancestors, minLen, seed = 26544
|
|
|
4882
5119
|
return false;
|
|
4883
5120
|
}
|
|
4884
5121
|
if (parent) {
|
|
4885
|
-
if (
|
|
4886
|
-
if (parent.source === node) return false;
|
|
4887
|
-
}
|
|
4888
|
-
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
5122
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
4889
5123
|
return false;
|
|
4890
5124
|
}
|
|
4891
|
-
if (parent.type === "
|
|
5125
|
+
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
4892
5126
|
return false;
|
|
4893
5127
|
}
|
|
4894
5128
|
}
|
|
@@ -4951,6 +5185,68 @@ function shouldEncryptString(val, minLen, parent, activeDirectives = DIRECTIVE_S
|
|
|
4951
5185
|
if (isTailwindNoise(val)) return false;
|
|
4952
5186
|
return true;
|
|
4953
5187
|
}
|
|
5188
|
+
var VAULT_WALK_BASE = {
|
|
5189
|
+
...walk4.base,
|
|
5190
|
+
Property(node, st, c) {
|
|
5191
|
+
c(node.key, st);
|
|
5192
|
+
if (node.value) c(node.value, st);
|
|
5193
|
+
}
|
|
5194
|
+
};
|
|
5195
|
+
function isCjsExportsTarget(lhs) {
|
|
5196
|
+
if (!lhs || typeof lhs !== "object") return false;
|
|
5197
|
+
if (lhs.type === "ParenthesizedExpression") {
|
|
5198
|
+
return isCjsExportsTarget(lhs.expression);
|
|
5199
|
+
}
|
|
5200
|
+
if (lhs.type === "Identifier") {
|
|
5201
|
+
return lhs.name === "exports";
|
|
5202
|
+
}
|
|
5203
|
+
if (lhs.type === "MemberExpression") {
|
|
5204
|
+
if (lhs.object?.type === "Identifier" && lhs.object.name === "module" && (!lhs.computed && lhs.property?.type === "Identifier" && lhs.property.name === "exports" || lhs.computed && lhs.property?.type === "Literal" && lhs.property.value === "exports")) {
|
|
5205
|
+
return true;
|
|
5206
|
+
}
|
|
5207
|
+
return isCjsExportsTarget(lhs.object);
|
|
5208
|
+
}
|
|
5209
|
+
return false;
|
|
5210
|
+
}
|
|
5211
|
+
function isInsideCjsExportsObject(ancestors, objIdx) {
|
|
5212
|
+
if (objIdx < 1) return false;
|
|
5213
|
+
let cur = ancestors[objIdx];
|
|
5214
|
+
for (let i = objIdx - 1; i >= 0; i--) {
|
|
5215
|
+
const anc = ancestors[i];
|
|
5216
|
+
if (!anc) break;
|
|
5217
|
+
if (anc.type === "ParenthesizedExpression") {
|
|
5218
|
+
cur = anc;
|
|
5219
|
+
continue;
|
|
5220
|
+
}
|
|
5221
|
+
if (anc.type === "AssignmentExpression" && anc.right === cur) {
|
|
5222
|
+
if (isCjsExportsTarget(anc.left)) {
|
|
5223
|
+
return true;
|
|
5224
|
+
}
|
|
5225
|
+
cur = anc;
|
|
5226
|
+
continue;
|
|
5227
|
+
}
|
|
5228
|
+
if (anc.type === "CallExpression" && anc.callee?.type === "MemberExpression" && !anc.callee.computed && anc.callee.object?.type === "Identifier" && anc.callee.object.name === "Object" && anc.callee.property?.type === "Identifier" && anc.callee.property.name === "assign" && Array.isArray(anc.arguments) && anc.arguments.slice(1).includes(cur) && isCjsExportsTarget(anc.arguments[0])) {
|
|
5229
|
+
return true;
|
|
5230
|
+
}
|
|
5231
|
+
break;
|
|
5232
|
+
}
|
|
5233
|
+
return false;
|
|
5234
|
+
}
|
|
5235
|
+
function isEligibleObjectPropertyKey(val, node, parent, ancestors) {
|
|
5236
|
+
if (!parent || parent.type !== "Property" || parent.key !== node || parent.computed) {
|
|
5237
|
+
return false;
|
|
5238
|
+
}
|
|
5239
|
+
if (val === "__proto__") return false;
|
|
5240
|
+
if (parent.kind !== "init" || parent.shorthand) return false;
|
|
5241
|
+
if (!isLikelySecretLiteral(val)) return false;
|
|
5242
|
+
const containerIdx = ancestors.length - 3;
|
|
5243
|
+
const container = containerIdx >= 0 ? ancestors[containerIdx] : void 0;
|
|
5244
|
+
if (!container || container.type === "ObjectPattern") return false;
|
|
5245
|
+
if (container.type === "ObjectExpression" && isInsideCjsExportsObject(ancestors, containerIdx)) {
|
|
5246
|
+
return false;
|
|
5247
|
+
}
|
|
5248
|
+
return true;
|
|
5249
|
+
}
|
|
4954
5250
|
function createPermutationTable(seed) {
|
|
4955
5251
|
let s = (seed || 305419896) >>> 0;
|
|
4956
5252
|
function xorshift() {
|
|
@@ -5090,7 +5386,7 @@ function isExemptTemplateLiteral(node, parent) {
|
|
|
5090
5386
|
if (parent.type === "TaggedTemplateExpression" && parent.quasi === node) {
|
|
5091
5387
|
return true;
|
|
5092
5388
|
}
|
|
5093
|
-
if (
|
|
5389
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
5094
5390
|
return true;
|
|
5095
5391
|
}
|
|
5096
5392
|
return false;
|
|
@@ -5301,7 +5597,7 @@ function isEligibleSecretRegExp(node, ancestors, hotExemptNodes, exemptSubtreeRo
|
|
|
5301
5597
|
}
|
|
5302
5598
|
return true;
|
|
5303
5599
|
}
|
|
5304
|
-
function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, windowKeySymbol, expectedDelta, deterrentMode, config, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots) {
|
|
5600
|
+
function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, windowKeySymbol, expectedDelta, deterrentMode, config, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots, latchCoupling) {
|
|
5305
5601
|
const minLen = config?.vault?.minStringLength ?? minStringLength;
|
|
5306
5602
|
const activeDirectives = new Set(DIRECTIVE_STRINGS);
|
|
5307
5603
|
if (config?.vault?.customDirectives) {
|
|
@@ -5350,7 +5646,8 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
5350
5646
|
sym,
|
|
5351
5647
|
SAFE_ALPHA,
|
|
5352
5648
|
shieldCoupled,
|
|
5353
|
-
browserOnly
|
|
5649
|
+
browserOnly,
|
|
5650
|
+
latchCoupling
|
|
5354
5651
|
);
|
|
5355
5652
|
const compactFnStr = generateCompactJs(fnAst);
|
|
5356
5653
|
const buildH = computeIntegrityHash(compactFnStr, 0);
|
|
@@ -5368,13 +5665,6 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
5368
5665
|
regExpShadowedScopes ??= collectIdentifierShadowedScopes(ast, "RegExp");
|
|
5369
5666
|
return regExpShadowedScopes;
|
|
5370
5667
|
};
|
|
5371
|
-
const customWalkBase = {
|
|
5372
|
-
...walk4.base,
|
|
5373
|
-
Property(node, st, c) {
|
|
5374
|
-
c(node.key, st);
|
|
5375
|
-
if (node.value) c(node.value, st);
|
|
5376
|
-
}
|
|
5377
|
-
};
|
|
5378
5668
|
function processVaultCandidate(val, node, parent, ancestors, onReplace) {
|
|
5379
5669
|
if (isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
|
|
5380
5670
|
return false;
|
|
@@ -5508,14 +5798,16 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
5508
5798
|
if (activeDirectives.has(val)) return;
|
|
5509
5799
|
const parent = ancestors[ancestors.length - 2];
|
|
5510
5800
|
if (!parent) return;
|
|
5511
|
-
if (
|
|
5512
|
-
|
|
5801
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
5802
|
+
return;
|
|
5513
5803
|
}
|
|
5514
5804
|
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
5515
5805
|
return;
|
|
5516
5806
|
}
|
|
5517
|
-
if (parent.type === "
|
|
5518
|
-
|
|
5807
|
+
if (parent.type === "Property" && parent.key === node && !parent.computed) {
|
|
5808
|
+
if (!isEligibleObjectPropertyKey(val, node, parent, ancestors)) {
|
|
5809
|
+
return;
|
|
5810
|
+
}
|
|
5519
5811
|
}
|
|
5520
5812
|
processVaultCandidate(val, node, parent, ancestors);
|
|
5521
5813
|
},
|
|
@@ -5558,7 +5850,7 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
5558
5850
|
}
|
|
5559
5851
|
}
|
|
5560
5852
|
},
|
|
5561
|
-
|
|
5853
|
+
VAULT_WALK_BASE
|
|
5562
5854
|
);
|
|
5563
5855
|
if (targetsToReplace.length === 0 && hotTargetsToReplace.length === 0) {
|
|
5564
5856
|
return {
|
|
@@ -5710,7 +6002,8 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
5710
6002
|
sym,
|
|
5711
6003
|
SAFE_ALPHA,
|
|
5712
6004
|
shieldCoupled,
|
|
5713
|
-
browserOnly
|
|
6005
|
+
browserOnly,
|
|
6006
|
+
latchCoupling
|
|
5714
6007
|
);
|
|
5715
6008
|
const buildHF = computeIntegrityHash(generateCompactJs(fnAstF), 0);
|
|
5716
6009
|
const expectedKeyF = (buildHF ^ 0 ^ (shieldCoupled ? (expDelta ?? 0) & 65535 : 0)) >>> 0;
|
|
@@ -6004,14 +6297,55 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
|
|
|
6004
6297
|
}
|
|
6005
6298
|
const manglerConfig = config?.mangler;
|
|
6006
6299
|
const scopeRecords = /* @__PURE__ */ new Map();
|
|
6300
|
+
const protectedScopeNodes = /* @__PURE__ */ new Set();
|
|
6007
6301
|
const barrierOrFreeIds = /* @__PURE__ */ new Set();
|
|
6008
6302
|
const renamedTargetNodes = /* @__PURE__ */ new WeakSet();
|
|
6009
6303
|
let counter = 0;
|
|
6304
|
+
function hasStrictDirective(stmts) {
|
|
6305
|
+
if (!Array.isArray(stmts)) return false;
|
|
6306
|
+
for (const stmt of stmts) {
|
|
6307
|
+
if (stmt?.type !== "ExpressionStatement") break;
|
|
6308
|
+
const isStrLit = stmt.expression?.type === "Literal" && typeof stmt.expression.value === "string";
|
|
6309
|
+
if (!stmt.directive && !isStrLit) break;
|
|
6310
|
+
if (stmt.directive === "use strict" || stmt.expression?.value === "use strict") {
|
|
6311
|
+
return true;
|
|
6312
|
+
}
|
|
6313
|
+
}
|
|
6314
|
+
return false;
|
|
6315
|
+
}
|
|
6316
|
+
function isSloppyFunctionNode(fnNode, ancestors) {
|
|
6317
|
+
if (fnNode.type === "ArrowFunctionExpression") return false;
|
|
6318
|
+
if (ast.sourceType === "module") return false;
|
|
6319
|
+
const parent = ancestors.length >= 2 ? ancestors[ancestors.length - 2] : null;
|
|
6320
|
+
if (parent && (parent.type === "MethodDefinition" || parent.type === "Property" && (parent.method || parent.kind === "get" || parent.kind === "set"))) {
|
|
6321
|
+
return false;
|
|
6322
|
+
}
|
|
6323
|
+
for (let i = 0; i < ancestors.length - 1; i++) {
|
|
6324
|
+
const anc = ancestors[i];
|
|
6325
|
+
if (anc.type === "ClassDeclaration" || anc.type === "ClassExpression") {
|
|
6326
|
+
return false;
|
|
6327
|
+
}
|
|
6328
|
+
if (anc.type === "Program" && hasStrictDirective(anc.body)) {
|
|
6329
|
+
return false;
|
|
6330
|
+
}
|
|
6331
|
+
if (FUNCTION_TYPES.has(anc.type) && anc.body?.type === "BlockStatement" && hasStrictDirective(anc.body.body)) {
|
|
6332
|
+
return false;
|
|
6333
|
+
}
|
|
6334
|
+
}
|
|
6335
|
+
if (fnNode.body?.type === "BlockStatement" && hasStrictDirective(fnNode.body.body)) {
|
|
6336
|
+
return false;
|
|
6337
|
+
}
|
|
6338
|
+
return true;
|
|
6339
|
+
}
|
|
6010
6340
|
function ensureScopeChain(ancestors) {
|
|
6341
|
+
const insideWith = ancestors.some((a) => a.type === "WithStatement");
|
|
6011
6342
|
let prevScope = null;
|
|
6012
6343
|
for (let i = 0; i < ancestors.length; i++) {
|
|
6013
6344
|
const node = ancestors[i];
|
|
6014
6345
|
if (!LEXICAL_SCOPE_TYPES.has(node.type)) continue;
|
|
6346
|
+
if (insideWith) {
|
|
6347
|
+
protectedScopeNodes.add(node);
|
|
6348
|
+
}
|
|
6015
6349
|
let record = scopeRecords.get(node);
|
|
6016
6350
|
if (!record) {
|
|
6017
6351
|
const isFn = FUNCTION_TYPES.has(node.type);
|
|
@@ -6098,16 +6432,45 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
|
|
|
6098
6432
|
}
|
|
6099
6433
|
function registerFunctionParams(fnNode, ancestors) {
|
|
6100
6434
|
ensureScopeChain(ancestors);
|
|
6101
|
-
|
|
6435
|
+
const params = fnNode.params || [];
|
|
6436
|
+
const duplicateParamNames = /* @__PURE__ */ new Set();
|
|
6437
|
+
const allSimpleParams = params.every((p) => p?.type === "Identifier");
|
|
6438
|
+
if (allSimpleParams && params.length > 1 && isSloppyFunctionNode(fnNode, ancestors)) {
|
|
6439
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6440
|
+
for (const p of params) {
|
|
6441
|
+
if (seen.has(p.name)) {
|
|
6442
|
+
duplicateParamNames.add(p.name);
|
|
6443
|
+
}
|
|
6444
|
+
seen.add(p.name);
|
|
6445
|
+
}
|
|
6446
|
+
}
|
|
6447
|
+
for (const param of params) {
|
|
6102
6448
|
const targets = [];
|
|
6103
6449
|
collectPatternTargets(param, targets);
|
|
6104
6450
|
for (const target of targets) {
|
|
6105
|
-
|
|
6451
|
+
const allowMangle = !duplicateParamNames.has(target.idNode.name);
|
|
6452
|
+
registerBindingTarget(fnNode, target, allowMangle, fnNode);
|
|
6106
6453
|
}
|
|
6107
6454
|
}
|
|
6108
6455
|
}
|
|
6109
6456
|
ensureScopeChain([ast]);
|
|
6110
6457
|
walk5.ancestor(ast, {
|
|
6458
|
+
CallExpression(node, _state, ancestors) {
|
|
6459
|
+
if (!node.optional && node.callee?.type === "Identifier" && node.callee.name === "eval") {
|
|
6460
|
+
for (const anc of ancestors) {
|
|
6461
|
+
if (LEXICAL_SCOPE_TYPES.has(anc.type)) {
|
|
6462
|
+
protectedScopeNodes.add(anc);
|
|
6463
|
+
}
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6466
|
+
},
|
|
6467
|
+
WithStatement(_node, _state, ancestors) {
|
|
6468
|
+
for (const anc of ancestors) {
|
|
6469
|
+
if (LEXICAL_SCOPE_TYPES.has(anc.type)) {
|
|
6470
|
+
protectedScopeNodes.add(anc);
|
|
6471
|
+
}
|
|
6472
|
+
}
|
|
6473
|
+
},
|
|
6111
6474
|
BlockStatement(_node, _state, ancestors) {
|
|
6112
6475
|
ensureScopeChain(ancestors);
|
|
6113
6476
|
},
|
|
@@ -6220,6 +6583,14 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
|
|
|
6220
6583
|
}
|
|
6221
6584
|
}
|
|
6222
6585
|
});
|
|
6586
|
+
for (const scopeNode of protectedScopeNodes) {
|
|
6587
|
+
const scope = scopeRecords.get(scopeNode);
|
|
6588
|
+
if (!scope) continue;
|
|
6589
|
+
for (const entry of scope.bindings.values()) {
|
|
6590
|
+
entry.shouldMangle = false;
|
|
6591
|
+
barrierOrFreeIds.add(entry.origName);
|
|
6592
|
+
}
|
|
6593
|
+
}
|
|
6223
6594
|
function resolveBinding(name, ancestors) {
|
|
6224
6595
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
6225
6596
|
const scope = scopeRecords.get(ancestors[i]);
|
|
@@ -6386,6 +6757,35 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
|
|
|
6386
6757
|
// src/ast/cold-flow-guard.ts
|
|
6387
6758
|
import * as acorn5 from "acorn";
|
|
6388
6759
|
import * as walk6 from "acorn-walk";
|
|
6760
|
+
function deriveColdFlowSuffix(seed) {
|
|
6761
|
+
return (seed >>> 0).toString(36).slice(0, 4);
|
|
6762
|
+
}
|
|
6763
|
+
function deriveColdAliasInitWords(seed) {
|
|
6764
|
+
const words = [
|
|
6765
|
+
mixSeed32(seed, 101),
|
|
6766
|
+
mixSeed32(seed, 103),
|
|
6767
|
+
mixSeed32(seed, 107),
|
|
6768
|
+
mixSeed32(seed, 109),
|
|
6769
|
+
mixSeed32(seed, 113),
|
|
6770
|
+
mixSeed32(seed, 127),
|
|
6771
|
+
mixSeed32(seed, 131),
|
|
6772
|
+
mixSeed32(seed, 137)
|
|
6773
|
+
];
|
|
6774
|
+
const latchByte = (words[0] ^ words[1]) & 255;
|
|
6775
|
+
if (latchByte === 0 || latchByte === 255) {
|
|
6776
|
+
words[1] = words[1] ^ 90 | 0;
|
|
6777
|
+
}
|
|
6778
|
+
return words;
|
|
6779
|
+
}
|
|
6780
|
+
function deriveColdLatchCoupling(seed) {
|
|
6781
|
+
const sfx = deriveColdFlowSuffix(seed);
|
|
6782
|
+
const initWords = deriveColdAliasInitWords(seed);
|
|
6783
|
+
const expectedLatchByte = (initWords[0] ^ initWords[1]) & 255;
|
|
6784
|
+
return {
|
|
6785
|
+
latchFnName: `_uLr${sfx}`,
|
|
6786
|
+
expectedLatchByte
|
|
6787
|
+
};
|
|
6788
|
+
}
|
|
6389
6789
|
var NEUTRAL_DECOY_KEYS = [
|
|
6390
6790
|
"telemetryOk",
|
|
6391
6791
|
"retryBudget",
|
|
@@ -6976,6 +7376,14 @@ function makePropAccess(objExpr, propName) {
|
|
|
6976
7376
|
property: makeLiteral(propName)
|
|
6977
7377
|
};
|
|
6978
7378
|
}
|
|
7379
|
+
function makeSafeAliasRead(aliasIdent, slot) {
|
|
7380
|
+
return {
|
|
7381
|
+
type: "ConditionalExpression",
|
|
7382
|
+
test: makeBinary("<", makeUnary("typeof", { type: "Identifier", name: aliasIdent }), makeLiteral("u")),
|
|
7383
|
+
consequent: makeMemberIndex(aliasIdent, makeLiteral(slot)),
|
|
7384
|
+
alternate: makeLiteral(0)
|
|
7385
|
+
};
|
|
7386
|
+
}
|
|
6979
7387
|
function buildQnrBitExpr(qnrValRef, bitKind) {
|
|
6980
7388
|
const shiftAmt = bitKind === "xor1" ? 1 : 2;
|
|
6981
7389
|
const combOp = bitKind === "xor1" ? "^" : "|";
|
|
@@ -6995,8 +7403,8 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
|
|
|
6995
7403
|
const mba4 = buildMba4Ast(seed, fnIndex, x1, x2, x3, x4);
|
|
6996
7404
|
const qnrFamilyIdx = ((seed ^ Math.imul(fnIndex + 1, 2654435761)) >>> 0) % QNR_RESIDUE_FAMILIES.length;
|
|
6997
7405
|
const qnrFamily = QNR_RESIDUE_FAMILIES[qnrFamilyIdx];
|
|
6998
|
-
const slotA = fnIndex + (seed &
|
|
6999
|
-
const slotB = slotA
|
|
7406
|
+
const slotA = 2 + (fnIndex + (seed & 1) & 1);
|
|
7407
|
+
const slotB = slotA ^ 1;
|
|
7000
7408
|
const hasAlias = Boolean(ctxOpts?.aliasIdentA);
|
|
7001
7409
|
const aliasReadIdent = ctxOpts?.aliasIdentB ?? ctxOpts?.aliasIdentA ?? "";
|
|
7002
7410
|
let qnrLeft;
|
|
@@ -7189,7 +7597,7 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
|
|
|
7189
7597
|
pathACore = makeBinary(
|
|
7190
7598
|
"^",
|
|
7191
7599
|
pathACore,
|
|
7192
|
-
makeBinary("&",
|
|
7600
|
+
makeBinary("&", makeSafeAliasRead(aliasReadIdent, slotB), makeLiteral(1))
|
|
7193
7601
|
);
|
|
7194
7602
|
}
|
|
7195
7603
|
const pathA = ctxOpts?.scratchVarIdent ? {
|
|
@@ -7199,7 +7607,7 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
|
|
|
7199
7607
|
const pathB = hasAlias ? makeBinary(
|
|
7200
7608
|
"^",
|
|
7201
7609
|
makeLiteral(qnrFamily.expectedBit),
|
|
7202
|
-
makeBinary("&",
|
|
7610
|
+
makeBinary("&", makeSafeAliasRead(ctxOpts.aliasIdentA, slotB), makeLiteral(1))
|
|
7203
7611
|
) : makeLiteral(qnrFamily.expectedBit);
|
|
7204
7612
|
testExpr = makeBinary("!==", makeBinary("^", pathA, pathB), makeLiteral(0));
|
|
7205
7613
|
} else if (predForm === 1) {
|
|
@@ -7246,8 +7654,8 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
|
|
|
7246
7654
|
right: tamperCheck
|
|
7247
7655
|
};
|
|
7248
7656
|
} else if (predForm === 2) {
|
|
7249
|
-
const slotReadB = hasAlias ? makeBinary("&",
|
|
7250
|
-
const slotWriteB = hasAlias ? makeBinary("&",
|
|
7657
|
+
const slotReadB = hasAlias ? makeBinary("&", makeSafeAliasRead(aliasReadIdent, slotB), makeLiteral(7)) : makeBinary("&", makeTypeofGlobalLen(), makeLiteral(7));
|
|
7658
|
+
const slotWriteB = hasAlias ? makeBinary("&", makeSafeAliasRead(ctxOpts.aliasIdentA, slotB), makeLiteral(7)) : makeBinary("&", makeTypeofGlobalLen(), makeLiteral(7));
|
|
7251
7659
|
let lhsExpr = makeBinary("+", qnrLeft, slotReadB);
|
|
7252
7660
|
if (aliasInvZero) {
|
|
7253
7661
|
lhsExpr = makeBinary("+", lhsExpr, makeBinary("&", aliasInvZero, makeLiteral(3)));
|
|
@@ -7255,8 +7663,8 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
|
|
|
7255
7663
|
const rhsExpr = makeBinary("+", makeLiteral(qnrFamily.outBoundVal), slotWriteB);
|
|
7256
7664
|
testExpr = makeBinary(qnrFamily.outBoundOp, lhsExpr, rhsExpr);
|
|
7257
7665
|
} else if (predForm === 3) {
|
|
7258
|
-
const tagLhs = hasAlias ? makeBinary("&",
|
|
7259
|
-
const tagRhsBase = hasAlias ? makeBinary("&",
|
|
7666
|
+
const tagLhs = hasAlias ? makeBinary("&", makeSafeAliasRead(ctxOpts.aliasIdentA, slotB), makeLiteral(240)) : makeBinary("&", makeBinary("<<", makeTypeofGlobalLen(), makeLiteral(4)), makeLiteral(240));
|
|
7667
|
+
const tagRhsBase = hasAlias ? makeBinary("&", makeSafeAliasRead(aliasReadIdent, slotB), makeLiteral(240)) : makeBinary("&", makeBinary("<<", makeTypeofGlobalLen(), makeLiteral(4)), makeLiteral(240));
|
|
7260
7668
|
const tagRhs = aliasInvZero ? makeBinary("^", tagRhsBase, makeBinary("&", aliasInvZero, makeLiteral(15))) : tagRhsBase;
|
|
7261
7669
|
const lhsExpr = makeBinary("|", makeBinary("^", qnrLeft, tagLhs), makeLiteral(0));
|
|
7262
7670
|
const rhsExpr = makeBinary("|", makeBinary("^", makeLiteral(qnrFamily.target), tagRhs), makeLiteral(0));
|
|
@@ -7394,18 +7802,25 @@ function inferFunctionReturnDomain(fnNode) {
|
|
|
7394
7802
|
if (seenString && !seenNumber && !seenBoolean) return "string";
|
|
7395
7803
|
return "object";
|
|
7396
7804
|
}
|
|
7397
|
-
function
|
|
7398
|
-
|
|
7805
|
+
function buildSboxInitExpression(seed) {
|
|
7806
|
+
return acorn5.parseExpressionAt(
|
|
7399
7807
|
`(function(){var a=[],i,s=${seed | 0},j,t;for(i=0;i<256;i++)a[i]=i;for(i=255;i>0;i--){s=(Math.imul(s,1664525)+1013904223)|0;j=(s>>>0)%(i+1);t=a[i];a[i]=a[j];a[j]=t;}return a;})()`,
|
|
7400
7808
|
0,
|
|
7401
7809
|
{ ecmaVersion: "latest" }
|
|
7402
7810
|
);
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7811
|
+
}
|
|
7812
|
+
function createColdFlowRuntimeDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scratchVarIdent, seed, latchFnName, mxIdent) {
|
|
7813
|
+
const sboxInit = buildSboxInitExpression(seed);
|
|
7814
|
+
const initWords = deriveColdAliasInitWords(seed);
|
|
7815
|
+
const wordsArrayExpr = {
|
|
7816
|
+
type: "ArrayExpression",
|
|
7817
|
+
elements: initWords.map((v) => makeInt32Literal(v))
|
|
7818
|
+
};
|
|
7819
|
+
const newArrayBuffer32 = {
|
|
7820
|
+
type: "NewExpression",
|
|
7821
|
+
callee: { type: "Identifier", name: "ArrayBuffer" },
|
|
7822
|
+
arguments: [makeLiteral(32)]
|
|
7823
|
+
};
|
|
7409
7824
|
const declarations = [
|
|
7410
7825
|
{
|
|
7411
7826
|
type: "VariableDeclarator",
|
|
@@ -7416,14 +7831,26 @@ function createSboxAndAliasDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scr
|
|
|
7416
7831
|
type: "VariableDeclarator",
|
|
7417
7832
|
id: { type: "Identifier", name: aliasIdentA },
|
|
7418
7833
|
init: {
|
|
7419
|
-
type: "
|
|
7420
|
-
|
|
7834
|
+
type: "NewExpression",
|
|
7835
|
+
callee: { type: "Identifier", name: "Uint32Array" },
|
|
7836
|
+
arguments: [newArrayBuffer32]
|
|
7421
7837
|
}
|
|
7422
7838
|
},
|
|
7423
7839
|
{
|
|
7424
7840
|
type: "VariableDeclarator",
|
|
7425
7841
|
id: { type: "Identifier", name: aliasIdentB },
|
|
7426
|
-
init: {
|
|
7842
|
+
init: {
|
|
7843
|
+
type: "NewExpression",
|
|
7844
|
+
callee: { type: "Identifier", name: "Int32Array" },
|
|
7845
|
+
arguments: [
|
|
7846
|
+
{
|
|
7847
|
+
type: "MemberExpression",
|
|
7848
|
+
computed: false,
|
|
7849
|
+
object: { type: "Identifier", name: aliasIdentA },
|
|
7850
|
+
property: { type: "Identifier", name: "buffer" }
|
|
7851
|
+
}
|
|
7852
|
+
]
|
|
7853
|
+
}
|
|
7427
7854
|
},
|
|
7428
7855
|
{
|
|
7429
7856
|
type: "VariableDeclarator",
|
|
@@ -7431,6 +7858,32 @@ function createSboxAndAliasDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scr
|
|
|
7431
7858
|
init: makeLiteral(0)
|
|
7432
7859
|
}
|
|
7433
7860
|
];
|
|
7861
|
+
const varDecl = {
|
|
7862
|
+
type: "VariableDeclaration",
|
|
7863
|
+
kind: "var",
|
|
7864
|
+
declarations
|
|
7865
|
+
};
|
|
7866
|
+
const aliasInitStmt = {
|
|
7867
|
+
type: "ExpressionStatement",
|
|
7868
|
+
expression: {
|
|
7869
|
+
type: "CallExpression",
|
|
7870
|
+
callee: {
|
|
7871
|
+
type: "MemberExpression",
|
|
7872
|
+
computed: false,
|
|
7873
|
+
object: { type: "Identifier", name: aliasIdentB },
|
|
7874
|
+
property: { type: "Identifier", name: "set" }
|
|
7875
|
+
},
|
|
7876
|
+
arguments: [cloneNode(wordsArrayExpr)],
|
|
7877
|
+
optional: false
|
|
7878
|
+
}
|
|
7879
|
+
};
|
|
7880
|
+
const wordsList = initWords.map((w) => w | 0).join(",");
|
|
7881
|
+
const latchFnParsed = acorn5.parse(
|
|
7882
|
+
`function ${latchFnName}(){try{return(${aliasIdentA}!==void 0&&${aliasIdentB}!==void 0)||(${aliasIdentA}=new Uint32Array(new ArrayBuffer(32)),${aliasIdentB}=new Int32Array(${aliasIdentA}.buffer),${aliasIdentB}.set([${wordsList}])),((${aliasIdentA}[0]^${aliasIdentB}[1])&255)}catch(e){return -1}}`,
|
|
7883
|
+
{ ecmaVersion: "latest", sourceType: "script" }
|
|
7884
|
+
);
|
|
7885
|
+
const latchFnDecl = latchFnParsed.body[0];
|
|
7886
|
+
let mxFnDecl;
|
|
7434
7887
|
if (mxIdent) {
|
|
7435
7888
|
const mbaAst = buildMba4Ast(
|
|
7436
7889
|
seed,
|
|
@@ -7440,9 +7893,48 @@ function createSboxAndAliasDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scr
|
|
|
7440
7893
|
{ type: "Identifier", name: "$p" },
|
|
7441
7894
|
{ type: "Identifier", name: "$q" }
|
|
7442
7895
|
);
|
|
7443
|
-
const
|
|
7444
|
-
|
|
7445
|
-
|
|
7896
|
+
const slotExpr = makeBinary("+", makeLiteral(2), makeBinary("&", { type: "Identifier", name: "$c" }, makeLiteral(1)));
|
|
7897
|
+
const lazyAliasGuard = {
|
|
7898
|
+
type: "ExpressionStatement",
|
|
7899
|
+
expression: {
|
|
7900
|
+
type: "LogicalExpression",
|
|
7901
|
+
operator: "||",
|
|
7902
|
+
left: {
|
|
7903
|
+
type: "LogicalExpression",
|
|
7904
|
+
operator: "&&",
|
|
7905
|
+
left: makeBinary("!==", { type: "Identifier", name: aliasIdentA }, makeUnary("void", makeLiteral(0))),
|
|
7906
|
+
right: makeBinary("!==", { type: "Identifier", name: aliasIdentB }, makeUnary("void", makeLiteral(0)))
|
|
7907
|
+
},
|
|
7908
|
+
right: {
|
|
7909
|
+
type: "LogicalExpression",
|
|
7910
|
+
operator: "||",
|
|
7911
|
+
left: makeBinary("!==", makeUnary("typeof", { type: "Identifier", name: latchFnName }), makeLiteral("function")),
|
|
7912
|
+
right: {
|
|
7913
|
+
type: "CallExpression",
|
|
7914
|
+
callee: { type: "Identifier", name: latchFnName },
|
|
7915
|
+
arguments: [],
|
|
7916
|
+
optional: false
|
|
7917
|
+
}
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
};
|
|
7921
|
+
const lazySboxGuard = {
|
|
7922
|
+
type: "ExpressionStatement",
|
|
7923
|
+
expression: {
|
|
7924
|
+
type: "LogicalExpression",
|
|
7925
|
+
operator: "||",
|
|
7926
|
+
left: { type: "Identifier", name: sboxIdent },
|
|
7927
|
+
right: {
|
|
7928
|
+
type: "AssignmentExpression",
|
|
7929
|
+
operator: "=",
|
|
7930
|
+
left: { type: "Identifier", name: sboxIdent },
|
|
7931
|
+
right: buildSboxInitExpression(seed)
|
|
7932
|
+
}
|
|
7933
|
+
}
|
|
7934
|
+
};
|
|
7935
|
+
mxFnDecl = {
|
|
7936
|
+
type: "FunctionDeclaration",
|
|
7937
|
+
id: { type: "Identifier", name: mxIdent },
|
|
7446
7938
|
params: [
|
|
7447
7939
|
{ type: "Identifier", name: "$a" },
|
|
7448
7940
|
{ type: "Identifier", name: "$b" },
|
|
@@ -7458,104 +7950,124 @@ function createSboxAndAliasDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scr
|
|
|
7458
7950
|
type: "BlockStatement",
|
|
7459
7951
|
body: [
|
|
7460
7952
|
{
|
|
7461
|
-
type: "
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
"
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
{ type: "Identifier", name: "$
|
|
7492
|
-
|
|
7953
|
+
type: "TryStatement",
|
|
7954
|
+
block: {
|
|
7955
|
+
type: "BlockStatement",
|
|
7956
|
+
body: [
|
|
7957
|
+
lazyAliasGuard,
|
|
7958
|
+
lazySboxGuard,
|
|
7959
|
+
{
|
|
7960
|
+
type: "VariableDeclaration",
|
|
7961
|
+
kind: "var",
|
|
7962
|
+
declarations: [
|
|
7963
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$s" }, init: slotExpr },
|
|
7964
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$u" }, init: makeBinary("|", { type: "Identifier", name: "$a" }, makeLiteral(0)) },
|
|
7965
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$v" }, init: makeBinary("|", { type: "Identifier", name: "$b" }, makeLiteral(0)) },
|
|
7966
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$p" }, init: makeBinary("|", makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }), makeLiteral(0)) },
|
|
7967
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$q" }, init: makeBinary("|", makeMemberIndex(aliasIdentB, { type: "Identifier", name: "$d" }), makeLiteral(0)) },
|
|
7968
|
+
{ type: "VariableDeclarator", id: { type: "Identifier", name: "$z" }, init: mbaAst }
|
|
7969
|
+
]
|
|
7970
|
+
},
|
|
7971
|
+
{
|
|
7972
|
+
type: "ExpressionStatement",
|
|
7973
|
+
expression: {
|
|
7974
|
+
type: "AssignmentExpression",
|
|
7975
|
+
operator: "=",
|
|
7976
|
+
left: { type: "Identifier", name: "$z" },
|
|
7977
|
+
right: makeBinary(
|
|
7978
|
+
"|",
|
|
7979
|
+
makeBinary(
|
|
7980
|
+
"+",
|
|
7981
|
+
{ type: "Identifier", name: "$f" },
|
|
7982
|
+
makeImul(
|
|
7983
|
+
{ type: "Identifier", name: "$z" },
|
|
7984
|
+
makeBinary(
|
|
7985
|
+
"+",
|
|
7986
|
+
{ type: "Identifier", name: "$g" },
|
|
7987
|
+
makeImul(
|
|
7988
|
+
{ type: "Identifier", name: "$z" },
|
|
7989
|
+
makeBinary(
|
|
7990
|
+
"+",
|
|
7991
|
+
{ type: "Identifier", name: "$h" },
|
|
7992
|
+
makeImul({ type: "Identifier", name: "$z" }, { type: "Identifier", name: "$i" })
|
|
7993
|
+
)
|
|
7994
|
+
)
|
|
7995
|
+
)
|
|
7493
7996
|
)
|
|
7494
|
-
)
|
|
7997
|
+
),
|
|
7998
|
+
makeLiteral(0)
|
|
7495
7999
|
)
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
8000
|
+
}
|
|
8001
|
+
},
|
|
8002
|
+
{
|
|
8003
|
+
type: "ExpressionStatement",
|
|
8004
|
+
expression: {
|
|
8005
|
+
type: "AssignmentExpression",
|
|
8006
|
+
operator: "=",
|
|
8007
|
+
left: { type: "Identifier", name: "$z" },
|
|
8008
|
+
right: buildSboxMixAst(sboxIdent, "$z")
|
|
8009
|
+
}
|
|
8010
|
+
},
|
|
8011
|
+
{
|
|
8012
|
+
type: "VariableDeclaration",
|
|
8013
|
+
kind: "var",
|
|
8014
|
+
declarations: [
|
|
8015
|
+
{
|
|
8016
|
+
type: "VariableDeclarator",
|
|
8017
|
+
id: { type: "Identifier", name: "$m" },
|
|
8018
|
+
init: makeBinary("^", makeBinary("<<", { type: "Identifier", name: "$z" }, makeLiteral(3)), { type: "Identifier", name: "$e" })
|
|
8019
|
+
}
|
|
8020
|
+
]
|
|
8021
|
+
},
|
|
8022
|
+
{
|
|
8023
|
+
type: "ExpressionStatement",
|
|
8024
|
+
expression: {
|
|
8025
|
+
type: "AssignmentExpression",
|
|
8026
|
+
operator: "=",
|
|
8027
|
+
left: makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }),
|
|
8028
|
+
right: makeBinary("|", makeBinary("^", makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }), { type: "Identifier", name: "$m" }), makeLiteral(0))
|
|
8029
|
+
}
|
|
8030
|
+
},
|
|
8031
|
+
{
|
|
8032
|
+
type: "VariableDeclaration",
|
|
8033
|
+
kind: "var",
|
|
8034
|
+
declarations: [
|
|
8035
|
+
{
|
|
8036
|
+
type: "VariableDeclarator",
|
|
8037
|
+
id: { type: "Identifier", name: "$w" },
|
|
8038
|
+
init: makeBinary(
|
|
8039
|
+
"^",
|
|
8040
|
+
makeBinary("|", makeBinary("^", makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }), { type: "Identifier", name: "$m" }), makeLiteral(0)),
|
|
8041
|
+
{
|
|
8042
|
+
type: "AssignmentExpression",
|
|
8043
|
+
operator: "=",
|
|
8044
|
+
left: makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }),
|
|
8045
|
+
right: makeBinary("|", makeBinary("^", makeMemberIndex(aliasIdentA, { type: "Identifier", name: "$s" }), { type: "Identifier", name: "$m" }), makeLiteral(0))
|
|
8046
|
+
}
|
|
8047
|
+
)
|
|
8048
|
+
}
|
|
8049
|
+
]
|
|
8050
|
+
},
|
|
8051
|
+
{
|
|
8052
|
+
type: "ReturnStatement",
|
|
8053
|
+
argument: {
|
|
7542
8054
|
type: "AssignmentExpression",
|
|
7543
8055
|
operator: "=",
|
|
7544
|
-
left:
|
|
7545
|
-
right: makeBinary("|", makeBinary("^",
|
|
8056
|
+
left: { type: "Identifier", name: scratchVarIdent },
|
|
8057
|
+
right: makeBinary("|", makeBinary("^", { type: "Identifier", name: "$z" }, { type: "Identifier", name: "$w" }), makeLiteral(0))
|
|
7546
8058
|
}
|
|
7547
|
-
|
|
8059
|
+
}
|
|
8060
|
+
]
|
|
8061
|
+
},
|
|
8062
|
+
handler: {
|
|
8063
|
+
type: "CatchClause",
|
|
8064
|
+
param: { type: "Identifier", name: "$e" },
|
|
8065
|
+
body: {
|
|
8066
|
+
type: "BlockStatement",
|
|
8067
|
+
body: [{ type: "ReturnStatement", argument: makeLiteral(0) }]
|
|
7548
8068
|
}
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
{
|
|
7552
|
-
type: "ReturnStatement",
|
|
7553
|
-
argument: {
|
|
7554
|
-
type: "AssignmentExpression",
|
|
7555
|
-
operator: "=",
|
|
7556
|
-
left: { type: "Identifier", name: scratchVarIdent },
|
|
7557
|
-
right: makeBinary("|", makeBinary("^", { type: "Identifier", name: "$z" }, { type: "Identifier", name: "$w" }), makeLiteral(0))
|
|
7558
|
-
}
|
|
8069
|
+
},
|
|
8070
|
+
finalizer: null
|
|
7559
8071
|
}
|
|
7560
8072
|
]
|
|
7561
8073
|
},
|
|
@@ -7563,16 +8075,12 @@ function createSboxAndAliasDeclarations(sboxIdent, aliasIdentA, aliasIdentB, scr
|
|
|
7563
8075
|
async: false,
|
|
7564
8076
|
expression: false
|
|
7565
8077
|
};
|
|
7566
|
-
declarations.push({
|
|
7567
|
-
type: "VariableDeclarator",
|
|
7568
|
-
id: { type: "Identifier", name: mxIdent },
|
|
7569
|
-
init: mxFn
|
|
7570
|
-
});
|
|
7571
8078
|
}
|
|
7572
8079
|
return {
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
8080
|
+
varDecl,
|
|
8081
|
+
aliasInitStmt,
|
|
8082
|
+
latchFnDecl,
|
|
8083
|
+
...mxFnDecl ? { mxFnDecl } : {}
|
|
7576
8084
|
};
|
|
7577
8085
|
}
|
|
7578
8086
|
var MAX_COLD_GUARDS_PER_CHUNK = 12;
|
|
@@ -7931,96 +8439,345 @@ function applyColdBitwiseMba(ast, coldFunctionNodes, seed = 2654435769, hotExemp
|
|
|
7931
8439
|
}, false);
|
|
7932
8440
|
return mbaCount;
|
|
7933
8441
|
}
|
|
8442
|
+
var UNSAFE_EXPRESSION_NODE_TYPES = /* @__PURE__ */ new Set(["Super", "WithStatement"]);
|
|
8443
|
+
var UNSAFE_IF_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
8444
|
+
"Super",
|
|
8445
|
+
"WithStatement",
|
|
8446
|
+
"FunctionDeclaration",
|
|
8447
|
+
"ClassDeclaration"
|
|
8448
|
+
]);
|
|
8449
|
+
function containsAstNodeType(node, types) {
|
|
8450
|
+
if (!node || typeof node !== "object") return false;
|
|
8451
|
+
if (Array.isArray(node)) {
|
|
8452
|
+
for (const item of node) {
|
|
8453
|
+
if (containsAstNodeType(item, types)) return true;
|
|
8454
|
+
}
|
|
8455
|
+
return false;
|
|
8456
|
+
}
|
|
8457
|
+
if (typeof node.type === "string" && types.has(node.type)) {
|
|
8458
|
+
return true;
|
|
8459
|
+
}
|
|
8460
|
+
for (const key of Object.keys(node)) {
|
|
8461
|
+
if (key === "loc" || key === "range" || key === "start" || key === "end" || key === "comments" || key === "tokens") {
|
|
8462
|
+
continue;
|
|
8463
|
+
}
|
|
8464
|
+
const val = node[key];
|
|
8465
|
+
if (val && typeof val === "object" && containsAstNodeType(val, types)) {
|
|
8466
|
+
return true;
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8469
|
+
return false;
|
|
8470
|
+
}
|
|
8471
|
+
function collectMathUnsafeScopes(ast) {
|
|
8472
|
+
const unsafe = /* @__PURE__ */ new WeakSet();
|
|
8473
|
+
const findEnclosing = (ancestors) => {
|
|
8474
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
8475
|
+
if (BITWISE_LEXICAL_SCOPE_TYPES.has(ancestors[i].type)) {
|
|
8476
|
+
return ancestors[i];
|
|
8477
|
+
}
|
|
8478
|
+
}
|
|
8479
|
+
return ast;
|
|
8480
|
+
};
|
|
8481
|
+
const markScopeAndEnclosingFn = (ancestors, scopeNode) => {
|
|
8482
|
+
unsafe.add(scopeNode);
|
|
8483
|
+
const parent = ancestors.length >= 2 ? ancestors[ancestors.length - 2] : null;
|
|
8484
|
+
if (parent && BITWISE_FUNCTION_TYPES.has(parent.type) && parent.body === scopeNode) {
|
|
8485
|
+
unsafe.add(parent);
|
|
8486
|
+
}
|
|
8487
|
+
};
|
|
8488
|
+
const patternHasMath = (pat) => {
|
|
8489
|
+
const names = [];
|
|
8490
|
+
collectBoundPatternNames(pat, names);
|
|
8491
|
+
return names.includes("Math");
|
|
8492
|
+
};
|
|
8493
|
+
walk6.ancestor(ast, {
|
|
8494
|
+
WithStatement(node, _st, ancestors) {
|
|
8495
|
+
unsafe.add(node);
|
|
8496
|
+
for (let i = ancestors.length - 2; i >= 0; i--) {
|
|
8497
|
+
const a = ancestors[i];
|
|
8498
|
+
if (BITWISE_FUNCTION_TYPES.has(a.type)) {
|
|
8499
|
+
unsafe.add(a);
|
|
8500
|
+
break;
|
|
8501
|
+
}
|
|
8502
|
+
if (a.type === "Program") break;
|
|
8503
|
+
}
|
|
8504
|
+
},
|
|
8505
|
+
ImportSpecifier(node) {
|
|
8506
|
+
if (node.local?.name === "Math") unsafe.add(ast);
|
|
8507
|
+
},
|
|
8508
|
+
ImportDefaultSpecifier(node) {
|
|
8509
|
+
if (node.local?.name === "Math") unsafe.add(ast);
|
|
8510
|
+
},
|
|
8511
|
+
ImportNamespaceSpecifier(node) {
|
|
8512
|
+
if (node.local?.name === "Math") unsafe.add(ast);
|
|
8513
|
+
},
|
|
8514
|
+
FunctionDeclaration(node, _st, ancestors) {
|
|
8515
|
+
if (node.id?.name === "Math") {
|
|
8516
|
+
const prefix = ancestors.slice(0, -1);
|
|
8517
|
+
markScopeAndEnclosingFn(prefix, findEnclosing(prefix));
|
|
8518
|
+
unsafe.add(node);
|
|
8519
|
+
}
|
|
8520
|
+
if (Array.isArray(node.params) && node.params.some(patternHasMath)) {
|
|
8521
|
+
unsafe.add(node);
|
|
8522
|
+
}
|
|
8523
|
+
},
|
|
8524
|
+
FunctionExpression(node) {
|
|
8525
|
+
if (node.id?.name === "Math" || Array.isArray(node.params) && node.params.some(patternHasMath)) {
|
|
8526
|
+
unsafe.add(node);
|
|
8527
|
+
}
|
|
8528
|
+
},
|
|
8529
|
+
ArrowFunctionExpression(node) {
|
|
8530
|
+
if (Array.isArray(node.params) && node.params.some(patternHasMath)) {
|
|
8531
|
+
unsafe.add(node);
|
|
8532
|
+
}
|
|
8533
|
+
},
|
|
8534
|
+
ClassDeclaration(node, _st, ancestors) {
|
|
8535
|
+
if (node.id?.name === "Math") {
|
|
8536
|
+
const prefix = ancestors.slice(0, -1);
|
|
8537
|
+
markScopeAndEnclosingFn(prefix, findEnclosing(prefix));
|
|
8538
|
+
unsafe.add(node);
|
|
8539
|
+
}
|
|
8540
|
+
},
|
|
8541
|
+
ClassExpression(node) {
|
|
8542
|
+
if (node.id?.name === "Math") {
|
|
8543
|
+
unsafe.add(node);
|
|
8544
|
+
}
|
|
8545
|
+
},
|
|
8546
|
+
CatchClause(node) {
|
|
8547
|
+
if (node.param && patternHasMath(node.param)) {
|
|
8548
|
+
unsafe.add(node);
|
|
8549
|
+
}
|
|
8550
|
+
},
|
|
8551
|
+
VariableDeclaration(node, _st, ancestors) {
|
|
8552
|
+
if (!Array.isArray(node.declarations) || !node.declarations.some((d) => patternHasMath(d?.id))) {
|
|
8553
|
+
return;
|
|
8554
|
+
}
|
|
8555
|
+
if (node.kind === "var") {
|
|
8556
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
8557
|
+
const a = ancestors[i];
|
|
8558
|
+
if (BITWISE_FUNCTION_TYPES.has(a.type) || a.type === "StaticBlock" || a.type === "Program") {
|
|
8559
|
+
unsafe.add(a);
|
|
8560
|
+
break;
|
|
8561
|
+
}
|
|
8562
|
+
}
|
|
8563
|
+
} else {
|
|
8564
|
+
const prefix = ancestors.slice(0, -1);
|
|
8565
|
+
markScopeAndEnclosingFn(prefix, findEnclosing(prefix));
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
});
|
|
8569
|
+
return unsafe;
|
|
8570
|
+
}
|
|
8571
|
+
function isAnyAncestorInSet(ancestors, set) {
|
|
8572
|
+
if (!set) return false;
|
|
8573
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
8574
|
+
if (set.has(ancestors[i])) return true;
|
|
8575
|
+
}
|
|
8576
|
+
return false;
|
|
8577
|
+
}
|
|
8578
|
+
function isDirectiveStatement(stmt) {
|
|
8579
|
+
if (!stmt || stmt.type !== "ExpressionStatement") return false;
|
|
8580
|
+
if (stmt.directive) return true;
|
|
8581
|
+
return stmt.expression?.type === "Literal" && typeof stmt.expression.value === "string" && /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim());
|
|
8582
|
+
}
|
|
8583
|
+
function isSafeC9Statement(stmt, hotExemptNodes) {
|
|
8584
|
+
if (!stmt || typeof stmt !== "object") return false;
|
|
8585
|
+
if (stmt._unpeekGuardSubtree === true) return false;
|
|
8586
|
+
if (hotExemptNodes?.has(stmt)) return false;
|
|
8587
|
+
if (stmt.type === "ExpressionStatement") {
|
|
8588
|
+
if (isDirectiveStatement(stmt)) return false;
|
|
8589
|
+
return !containsAstNodeType(stmt, UNSAFE_EXPRESSION_NODE_TYPES);
|
|
8590
|
+
}
|
|
8591
|
+
if (stmt.type === "IfStatement") {
|
|
8592
|
+
return !containsAstNodeType(stmt, UNSAFE_IF_NODE_TYPES);
|
|
8593
|
+
}
|
|
8594
|
+
return false;
|
|
8595
|
+
}
|
|
7934
8596
|
function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExemptNodes, windowKeySymbol, expectedDelta, shieldCoupled = false, options) {
|
|
7935
|
-
const sfx = (seed
|
|
8597
|
+
const sfx = deriveColdFlowSuffix(seed);
|
|
7936
8598
|
const decoyIdent = `_uDec${sfx}`;
|
|
7937
8599
|
const sboxIdent = `_uSb${sfx}`;
|
|
7938
8600
|
const aliasIdentA = `_uAl${sfx}`;
|
|
7939
8601
|
const aliasIdentB = `_uAm${sfx}`;
|
|
7940
8602
|
const scratchVarIdent = `_uZt${sfx}`;
|
|
7941
8603
|
const mxIdent = `_uMx${sfx}`;
|
|
8604
|
+
const latchFnName = `_uLr${sfx}`;
|
|
7942
8605
|
if (Array.isArray(ast.body)) {
|
|
7943
8606
|
const alreadyGuarded = ast.body.some(
|
|
7944
8607
|
(stmt) => stmt.type === "VariableDeclaration" && stmt.declarations?.some(
|
|
7945
8608
|
(d) => d.id?.type === "Identifier" && (d.id.name === decoyIdent || d.id.name === sboxIdent || d.id.name === mxIdent)
|
|
7946
|
-
)
|
|
8609
|
+
) || stmt.type === "FunctionDeclaration" && stmt.id?.type === "Identifier" && (stmt.id.name === mxIdent || stmt.id.name === latchFnName)
|
|
7947
8610
|
);
|
|
7948
8611
|
if (alreadyGuarded) return 0;
|
|
7949
8612
|
}
|
|
7950
8613
|
if (options?.enableBitwiseMba) {
|
|
7951
8614
|
applyColdBitwiseMba(ast, coldFunctionNodes, seed, hotExemptNodes);
|
|
7952
8615
|
}
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
8616
|
+
const mathUnsafeScopes = collectMathUnsafeScopes(ast);
|
|
8617
|
+
const C9_RESERVED_SLOTS = 4;
|
|
8618
|
+
const eligibleColdFns = [];
|
|
8619
|
+
function collectEligibleColdFn(node, _state, ancestors) {
|
|
8620
|
+
if (eligibleColdFns.length >= MAX_COLD_GUARDS_PER_CHUNK) return;
|
|
7956
8621
|
if (!coldFunctionNodes.has(node)) return;
|
|
7957
|
-
if (
|
|
8622
|
+
if (isAnyAncestorInSet(ancestors, hotExemptNodes)) return;
|
|
8623
|
+
if (isAnyAncestorInSet(ancestors, mathUnsafeScopes)) return;
|
|
8624
|
+
if (node._unpeekSerialized) return;
|
|
7958
8625
|
if (node._unpeekVirtualized === true) return;
|
|
7959
8626
|
if (!node.body || node.body.type !== "BlockStatement") return;
|
|
7960
8627
|
const paramNames = [];
|
|
7961
8628
|
for (const p of node.params || []) {
|
|
7962
8629
|
extractParamNames(p, paramNames);
|
|
7963
8630
|
}
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
8631
|
+
eligibleColdFns.push({
|
|
8632
|
+
node,
|
|
8633
|
+
paramNames,
|
|
8634
|
+
firstParam: node.params?.[0],
|
|
8635
|
+
isArrow: node.type === "ArrowFunctionExpression",
|
|
8636
|
+
returnDomain: inferFunctionReturnDomain(node)
|
|
8637
|
+
});
|
|
8638
|
+
}
|
|
8639
|
+
walk6.ancestor(ast, {
|
|
8640
|
+
FunctionDeclaration: collectEligibleColdFn,
|
|
8641
|
+
FunctionExpression: collectEligibleColdFn,
|
|
8642
|
+
ArrowFunctionExpression: collectEligibleColdFn
|
|
8643
|
+
});
|
|
8644
|
+
let availableC9Slots = 0;
|
|
8645
|
+
for (const fnInfo of eligibleColdFns) {
|
|
8646
|
+
if (availableC9Slots >= C9_RESERVED_SLOTS) break;
|
|
8647
|
+
const bodyStmts = fnInfo.node.body.body;
|
|
8648
|
+
let idx = 0;
|
|
8649
|
+
while (idx < bodyStmts.length && isDirectiveStatement(bodyStmts[idx])) {
|
|
8650
|
+
idx++;
|
|
8651
|
+
}
|
|
8652
|
+
for (; idx < bodyStmts.length; idx++) {
|
|
8653
|
+
if (isSafeC9Statement(bodyStmts[idx], hotExemptNodes)) {
|
|
8654
|
+
availableC9Slots++;
|
|
8655
|
+
if (availableC9Slots >= C9_RESERVED_SLOTS) break;
|
|
8656
|
+
}
|
|
8657
|
+
}
|
|
8658
|
+
}
|
|
8659
|
+
const opaqueFalseLimit = MAX_COLD_GUARDS_PER_CHUNK - availableC9Slots;
|
|
8660
|
+
let opaqueFalseCount = 0;
|
|
8661
|
+
for (let i = 0; i < eligibleColdFns.length && opaqueFalseCount < opaqueFalseLimit; i++) {
|
|
8662
|
+
const fnInfo = eligibleColdFns[i];
|
|
7967
8663
|
const guardStmt = createSotaMbaPredicate(
|
|
7968
8664
|
seed,
|
|
7969
|
-
|
|
7970
|
-
firstParam,
|
|
8665
|
+
opaqueFalseCount,
|
|
8666
|
+
fnInfo.firstParam,
|
|
7971
8667
|
decoyIdent,
|
|
7972
|
-
isArrow,
|
|
8668
|
+
fnInfo.isArrow,
|
|
7973
8669
|
{
|
|
7974
|
-
liveVars: paramNames,
|
|
8670
|
+
liveVars: fnInfo.paramNames,
|
|
7975
8671
|
sboxIdent,
|
|
7976
8672
|
aliasIdentA,
|
|
7977
8673
|
aliasIdentB,
|
|
7978
8674
|
scratchVarIdent,
|
|
7979
8675
|
mxIdent,
|
|
7980
|
-
returnDomain,
|
|
8676
|
+
returnDomain: fnInfo.returnDomain,
|
|
7981
8677
|
windowKeySymbol,
|
|
7982
8678
|
expectedDelta,
|
|
7983
8679
|
shieldCoupled
|
|
7984
8680
|
}
|
|
7985
8681
|
);
|
|
7986
|
-
|
|
8682
|
+
opaqueFalseCount++;
|
|
7987
8683
|
guardStmt._unpeekGuardSubtree = true;
|
|
7988
8684
|
if (hotExemptNodes) {
|
|
7989
8685
|
hotExemptNodes.add(guardStmt);
|
|
7990
8686
|
hotExemptNodes.add(guardStmt.consequent);
|
|
7991
8687
|
}
|
|
7992
8688
|
let insertIdx = 0;
|
|
7993
|
-
while (insertIdx < node.body.body.length &&
|
|
8689
|
+
while (insertIdx < fnInfo.node.body.body.length && isDirectiveStatement(fnInfo.node.body.body[insertIdx])) {
|
|
7994
8690
|
insertIdx++;
|
|
7995
8691
|
}
|
|
7996
|
-
node.body.body.splice(insertIdx, 0, guardStmt);
|
|
8692
|
+
fnInfo.node.body.body.splice(insertIdx, 0, guardStmt);
|
|
7997
8693
|
}
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8694
|
+
let c9WrappedCount = 0;
|
|
8695
|
+
if (eligibleColdFns.length > 0 && opaqueFalseCount < MAX_COLD_GUARDS_PER_CHUNK) {
|
|
8696
|
+
const fnCursors = eligibleColdFns.map((fnInfo) => {
|
|
8697
|
+
const bodyStmts = fnInfo.node.body.body;
|
|
8698
|
+
let startIdx = 0;
|
|
8699
|
+
while (startIdx < bodyStmts.length && isDirectiveStatement(bodyStmts[startIdx])) {
|
|
8700
|
+
startIdx++;
|
|
8701
|
+
}
|
|
8702
|
+
return { fnInfo, bodyStmts, idx: startIdx };
|
|
8703
|
+
});
|
|
8704
|
+
let progress = true;
|
|
8705
|
+
while (progress && opaqueFalseCount + c9WrappedCount < MAX_COLD_GUARDS_PER_CHUNK) {
|
|
8706
|
+
progress = false;
|
|
8707
|
+
for (const cursor of fnCursors) {
|
|
8708
|
+
if (opaqueFalseCount + c9WrappedCount >= MAX_COLD_GUARDS_PER_CHUNK) break;
|
|
8709
|
+
const { fnInfo, bodyStmts } = cursor;
|
|
8710
|
+
while (cursor.idx < bodyStmts.length) {
|
|
8711
|
+
const stmt = bodyStmts[cursor.idx];
|
|
8712
|
+
const curIdx = cursor.idx++;
|
|
8713
|
+
if (!isSafeC9Statement(stmt, hotExemptNodes)) continue;
|
|
8714
|
+
const pred = createSotaMbaPredicate(
|
|
8715
|
+
seed,
|
|
8716
|
+
opaqueFalseCount + c9WrappedCount,
|
|
8717
|
+
fnInfo.firstParam,
|
|
8718
|
+
decoyIdent,
|
|
8719
|
+
fnInfo.isArrow,
|
|
8720
|
+
{
|
|
8721
|
+
liveVars: fnInfo.paramNames,
|
|
8722
|
+
sboxIdent,
|
|
8723
|
+
aliasIdentA,
|
|
8724
|
+
aliasIdentB,
|
|
8725
|
+
scratchVarIdent,
|
|
8726
|
+
mxIdent,
|
|
8727
|
+
returnDomain: "void",
|
|
8728
|
+
windowKeySymbol,
|
|
8729
|
+
expectedDelta,
|
|
8730
|
+
shieldCoupled
|
|
8731
|
+
}
|
|
8732
|
+
);
|
|
8733
|
+
const negatedTest = makeUnary("!", pred.test);
|
|
8734
|
+
negatedTest._unpeekGuardSubtree = true;
|
|
8735
|
+
if (hotExemptNodes) {
|
|
8736
|
+
hotExemptNodes.add(negatedTest);
|
|
8737
|
+
}
|
|
8738
|
+
bodyStmts[curIdx] = {
|
|
8739
|
+
type: "IfStatement",
|
|
8740
|
+
test: negatedTest,
|
|
8741
|
+
consequent: {
|
|
8742
|
+
type: "BlockStatement",
|
|
8743
|
+
body: [stmt]
|
|
8744
|
+
},
|
|
8745
|
+
alternate: null
|
|
8746
|
+
};
|
|
8747
|
+
c9WrappedCount++;
|
|
8748
|
+
progress = true;
|
|
8749
|
+
break;
|
|
8750
|
+
}
|
|
8751
|
+
}
|
|
8752
|
+
}
|
|
8753
|
+
}
|
|
8754
|
+
if ((opaqueFalseCount > 0 || c9WrappedCount > 0) && Array.isArray(ast.body)) {
|
|
8004
8755
|
const sharedDecoyDecl = createSharedDecoyDeclaration(
|
|
8005
8756
|
decoyIdent,
|
|
8006
|
-
|
|
8757
|
+
Math.max(1, opaqueFalseCount),
|
|
8007
8758
|
seed
|
|
8008
8759
|
);
|
|
8009
|
-
const
|
|
8760
|
+
const { varDecl, aliasInitStmt, latchFnDecl, mxFnDecl } = createColdFlowRuntimeDeclarations(
|
|
8010
8761
|
sboxIdent,
|
|
8011
8762
|
aliasIdentA,
|
|
8012
8763
|
aliasIdentB,
|
|
8013
8764
|
scratchVarIdent,
|
|
8014
8765
|
seed,
|
|
8766
|
+
latchFnName,
|
|
8015
8767
|
mxIdent
|
|
8016
8768
|
);
|
|
8769
|
+
aliasInitStmt._unpeekGuardSubtree = true;
|
|
8770
|
+
latchFnDecl._unpeekGuardSubtree = true;
|
|
8771
|
+
if (mxFnDecl) {
|
|
8772
|
+
mxFnDecl._unpeekGuardSubtree = true;
|
|
8773
|
+
}
|
|
8017
8774
|
if (hotExemptNodes) {
|
|
8018
8775
|
hotExemptNodes.add(sharedDecoyDecl);
|
|
8019
|
-
hotExemptNodes.add(
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8776
|
+
hotExemptNodes.add(varDecl);
|
|
8777
|
+
hotExemptNodes.add(aliasInitStmt);
|
|
8778
|
+
hotExemptNodes.add(latchFnDecl);
|
|
8779
|
+
if (mxFnDecl) {
|
|
8780
|
+
hotExemptNodes.add(mxFnDecl);
|
|
8024
8781
|
}
|
|
8025
8782
|
for (const decl of sharedDecoyDecl.declarations || []) {
|
|
8026
8783
|
if (decl.init?.type === "ArrayExpression" && decl.init.elements) {
|
|
@@ -8040,9 +8797,16 @@ function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExempt
|
|
|
8040
8797
|
break;
|
|
8041
8798
|
}
|
|
8042
8799
|
}
|
|
8043
|
-
|
|
8800
|
+
const injectedDecls = [
|
|
8801
|
+
varDecl,
|
|
8802
|
+
aliasInitStmt,
|
|
8803
|
+
latchFnDecl,
|
|
8804
|
+
...mxFnDecl ? [mxFnDecl] : [],
|
|
8805
|
+
sharedDecoyDecl
|
|
8806
|
+
];
|
|
8807
|
+
ast.body.splice(insertIdx, 0, ...injectedDecls);
|
|
8044
8808
|
}
|
|
8045
|
-
return
|
|
8809
|
+
return opaqueFalseCount;
|
|
8046
8810
|
}
|
|
8047
8811
|
|
|
8048
8812
|
// src/ast/micro-vm.ts
|
|
@@ -8091,7 +8855,8 @@ var OP_TRY = 39;
|
|
|
8091
8855
|
var OP_ENDTRY = 40;
|
|
8092
8856
|
var OP_NULLISH = 41;
|
|
8093
8857
|
var OP_DUP = 42;
|
|
8094
|
-
var
|
|
8858
|
+
var OP_TOSTR = 43;
|
|
8859
|
+
var OPCODE_COUNT = 44;
|
|
8095
8860
|
function shuffleRange(n, seed) {
|
|
8096
8861
|
const arr = [];
|
|
8097
8862
|
for (let i = 0; i < n; i++) arr.push(i);
|
|
@@ -8275,7 +9040,8 @@ function createInterpreterSource(vmHelperName, opMap, seed = 2654435769, windowK
|
|
|
8275
9040
|
[OP_TRY]: { body: "var $cp=($rd($f)-$Z)&0xffff,$cs=$f.c[$f.p++]^$f.st,$ca=$f.c[$f.p++]^$f.ac;$f.e.push({p:$cp,r:$f.r,s:$cs,a:$ca});" },
|
|
8276
9041
|
[OP_ENDTRY]: { body: "$f.r=($f.r+$Z)|0;$f.e.pop();$f.r=($f.r-$B)|0;" },
|
|
8277
9042
|
[OP_NULLISH]: { body: "$f.r=($f.r+$Z)|0;var $v=$f.q[$f.r-(1+$B)];$f.q[$f.r-(1+$B)]=($v===null||$v===void 0);$f.r=($f.r-$B)|0;" },
|
|
8278
|
-
[OP_DUP]: { body: "$f.r=($f.r+$Z)|0;var $top=$f.q[$f.r-(1+$B)];$f.q[($f.r++)-$B]=$top;$f.r=($f.r-$B)|0;" }
|
|
9043
|
+
[OP_DUP]: { body: "$f.r=($f.r+$Z)|0;var $top=$f.q[$f.r-(1+$B)];$f.q[($f.r++)-$B]=$top;$f.r=($f.r-$B)|0;" },
|
|
9044
|
+
[OP_TOSTR]: { body: "$f.r=($f.r+$Z)|0;var $v=$f.q[$f.r-(1+$B)];$f.r=($f.r-$B)|0;$f.q[$f.r-1]=`${$v}`;" }
|
|
8279
9045
|
};
|
|
8280
9046
|
const handlers = new Array(opCount);
|
|
8281
9047
|
for (let op = 0; op < opCount; op++) {
|
|
@@ -8882,6 +9648,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings, seed = 2654
|
|
|
8882
9648
|
emit(OP_LDC, addConst(quasis[0]?.value?.cooked ?? quasis[0]?.value?.raw ?? ""));
|
|
8883
9649
|
for (let i = 0; i < exprs.length; i++) {
|
|
8884
9650
|
if (!compileExpr(exprs[i], true)) return false;
|
|
9651
|
+
emit(OP_TOSTR);
|
|
8885
9652
|
emit(OP_ADD);
|
|
8886
9653
|
const qStr = quasis[i + 1]?.value?.cooked ?? quasis[i + 1]?.value?.raw ?? "";
|
|
8887
9654
|
if (qStr.length > 0) {
|
|
@@ -10054,7 +10821,7 @@ function scrubResidualPaths(ast, options = {}, hotExemptNodes, exemptSubtreeRoot
|
|
|
10054
10821
|
if (exemptSet?.has(val)) return;
|
|
10055
10822
|
const parent = ancestors[ancestors.length - 2];
|
|
10056
10823
|
if (!parent) return;
|
|
10057
|
-
if ((
|
|
10824
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
10058
10825
|
return;
|
|
10059
10826
|
}
|
|
10060
10827
|
if (parent.type === "ExpressionStatement" && Boolean(parent.directive)) {
|
|
@@ -10076,7 +10843,7 @@ function scrubResidualPaths(ast, options = {}, hotExemptNodes, exemptSubtreeRoot
|
|
|
10076
10843
|
return;
|
|
10077
10844
|
}
|
|
10078
10845
|
const parent = ancestors[ancestors.length - 2];
|
|
10079
|
-
if (
|
|
10846
|
+
if (isStaticModuleOrAssetPosition(node, parent)) {
|
|
10080
10847
|
return;
|
|
10081
10848
|
}
|
|
10082
10849
|
for (const quasi of node.quasis) {
|
|
@@ -10131,7 +10898,7 @@ function isAstAlreadyProtected(ast) {
|
|
|
10131
10898
|
}
|
|
10132
10899
|
if (stmt.type === "FunctionDeclaration" && stmt.id?.type === "Identifier") {
|
|
10133
10900
|
const fnName = stmt.id.name;
|
|
10134
|
-
if (typeof fnName === "string" && (fnName.startsWith("_uD") || fnName.startsWith("_uVm") || fnName.startsWith("_wKdf") || fnName === "_hX")) {
|
|
10901
|
+
if (typeof fnName === "string" && (fnName.startsWith("_uD") || fnName.startsWith("_uVm") || fnName.startsWith("_wKdf") || fnName.startsWith("_uLr") || fnName.startsWith("_uMx") || fnName === "_hX")) {
|
|
10135
10902
|
return true;
|
|
10136
10903
|
}
|
|
10137
10904
|
}
|
|
@@ -10282,8 +11049,9 @@ function transformJavaScript(code, options = {}) {
|
|
|
10282
11049
|
);
|
|
10283
11050
|
virtualizedFunctionsCount = vmRes.virtualizedCount;
|
|
10284
11051
|
}
|
|
11052
|
+
let coldFlowGuardedCount = 0;
|
|
10285
11053
|
if (effectiveProfile !== "minimal" && effectiveConfig?.coldFlow !== false) {
|
|
10286
|
-
applyColdFlowGuard(
|
|
11054
|
+
coldFlowGuardedCount = applyColdFlowGuard(
|
|
10287
11055
|
ast,
|
|
10288
11056
|
coldFunctionNodes,
|
|
10289
11057
|
seed,
|
|
@@ -10294,6 +11062,7 @@ function transformJavaScript(code, options = {}) {
|
|
|
10294
11062
|
{ enableBitwiseMba: isAggressive || effectiveProfile === "strict" }
|
|
10295
11063
|
);
|
|
10296
11064
|
}
|
|
11065
|
+
const latchCoupling = coldFlowGuardedCount > 0 ? deriveColdLatchCoupling(seed) : void 0;
|
|
10297
11066
|
const mangledSymbolsCount = applyPolymorphicMangler(
|
|
10298
11067
|
ast,
|
|
10299
11068
|
seed,
|
|
@@ -10315,7 +11084,8 @@ function transformJavaScript(code, options = {}) {
|
|
|
10315
11084
|
deterrentMode,
|
|
10316
11085
|
shieldCoupled,
|
|
10317
11086
|
detectHeadless,
|
|
10318
|
-
boundary.exemptSubtreeRoots
|
|
11087
|
+
boundary.exemptSubtreeRoots,
|
|
11088
|
+
latchCoupling
|
|
10319
11089
|
);
|
|
10320
11090
|
encryptedStringsCount = saltedRes.encryptedStringsCount;
|
|
10321
11091
|
integrityToken = saltedRes.integrityToken;
|
|
@@ -10332,7 +11102,8 @@ function transformJavaScript(code, options = {}) {
|
|
|
10332
11102
|
effectiveConfig,
|
|
10333
11103
|
shieldCoupled,
|
|
10334
11104
|
detectHeadless,
|
|
10335
|
-
boundary.exemptSubtreeRoots
|
|
11105
|
+
boundary.exemptSubtreeRoots,
|
|
11106
|
+
latchCoupling
|
|
10336
11107
|
);
|
|
10337
11108
|
encryptedStringsCount = vaultRes.encryptedStringsCount;
|
|
10338
11109
|
integrityToken = vaultRes.integrityToken;
|