js-confuser 1.4.1 → 1.4.2
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/CHANGELOG.md +6 -0
- package/dist/transforms/eval.js +1 -1
- package/package.json +1 -1
- package/src/transforms/eval.ts +2 -1
- package/test/transforms/eval.test.ts +28 -0
package/CHANGELOG.md
CHANGED
package/dist/transforms/eval.js
CHANGED
|
@@ -27,7 +27,7 @@ class Eval extends _transform.default {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
match(object, parents) {
|
|
30
|
-
return (0, _insert.isFunction)(object) && object.type != "ArrowFunctionExpression" && !object.$eval;
|
|
30
|
+
return (0, _insert.isFunction)(object) && object.type != "ArrowFunctionExpression" && !object.$eval && !object.$dispatcherSkip;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
transform(object, parents) {
|
package/package.json
CHANGED
package/src/transforms/eval.ts
CHANGED
|
@@ -48,3 +48,31 @@ it("should move function declarations to the top of the block", async () => {
|
|
|
48
48
|
|
|
49
49
|
expect(value).toStrictEqual(100);
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
it("should work with Integrity also enabled", async () => {
|
|
53
|
+
var code = `
|
|
54
|
+
input("Hello World")
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
var output = await JsConfuser(code, {
|
|
58
|
+
target: "node",
|
|
59
|
+
compact: false,
|
|
60
|
+
eval: true,
|
|
61
|
+
lock: {
|
|
62
|
+
integrity: true,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(output).toContain("eval(");
|
|
67
|
+
|
|
68
|
+
var value = "never_called",
|
|
69
|
+
input = (valueIn) => (value = valueIn);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
eval(output);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
expect(e).toStrictEqual(undefined);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
expect(value).toStrictEqual("Hello World");
|
|
78
|
+
});
|