8000 Merge pull request #639 from javascript-obfuscator/precedence-of-sequ… · sec-js/javascript-obfuscator@bf7511b · GitHub
[go: up one dir, main page]

Skip to content

Commit bf7511b

Browse files
authored
Merge pull request javascript-obfuscator#639 from javascript-obfuscator/precedence-of-sequence-expression-in-computed-property
Fixed precedence of sequence expression in computed property
2 parents 3727fe2 + 49259f1 commit bf7511b

File tree

9 files changed

+78
-54
lines changed

9 files changed

+78
-54
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Change Log
22

3+
v1.1.1
4+
---
5+
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/638
6+
37
v1.1.0
48
---
59
* **New option:** `renameProperties` enables renaming of property names

dist/index.browser.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.cli.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-obfuscator",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "JavaScript obfuscator",
55
"keywords": [
66
"obfuscator",
@@ -28,7 +28,7 @@
2828
"chance": "1.1.6",
2929
"class-validator": "0.12.2",
3030
"commander": "5.1.0",
31-
"escodegen": "1.14.2",
31+
"escodegen": "1.14.3",
3232
"eslint-scope": "5.1.0",
3333
"estraverse": "5.1.0",
3434
"eventemitter3": "4.0.4",
@@ -59,11 +59,11 @@
5959
"@types/sinon": "9.0.4",
6060
"@types/string-template": "1.0.2",
6161
"@types/webpack-env": "1.15.2",
62-
"@typescript-eslint/eslint-plugin": "3.3.0",
63-
"@typescript-eslint/parser": "3.3.0",
62+
"@typescript-eslint/eslint-plugin": "3.4.0",
63+
"@typescript-eslint/parser": "3.4.0",
6464
"chai": "4.2.0",
6565
"coveralls": "3.1.0",
66-
"eslint": "7.3.0",
66+
"eslint": "7.3.1",
6767
"eslint-plugin-import": "2.21.2",
6868
"eslint-plugin-jsdoc": "28.0.0",
6969
"eslint-plugin-no-null": "1.0.2",
@@ -77,7 +77,7 @@
7777
"pre-commit": "1.2.2",
7878
"rimraf": "3.0.2",
7979
"sinon": "9.0.2",
80-
"threads": "1.6.1",
80+
"threads": "1.6.2",
8181
"ts-loader": "7.0.5",
8282
"ts-node": "8.10.2",
8383
"typescript": "3.9.5",

test/dev/dev.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNo
77

88
let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
99
`
10-
(function () {
11-
const foo = {
12-
prop1: 1,
13-
prop2: 2,
14-
calc: function () {
15-
return this.prop1 + this.prop2;
16-
}
17-
};
18-
19-
console.log(foo.calc());
20-
})();
10+
class Foo {
11+
[(1, Symbol.asyncIterator)]() {}
12+
}
2113
`,
2214
{
2315
...NO_ADDITIONAL_NODES_PRESET,

test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,30 @@ describe('JavaScriptObfuscator', () => {
571571
});
572572
});
573573

574+
/**
575+
* https://github.com/estools/escodegen/pull/415
576+
*/
577+
describe('Precedence of `SequenceExpression` in computed property', () => {
578+
const regExp: RegExp = /class Foo *{ *\[\(bar, *baz\)]\(\) *{ *} * *}/;
579+
580+
let obfuscatedCode: string;
581+
582+
beforeEach(() => {
583+
const code: string = readFileAsString(__dirname + '/fixtures/precedence-of-sequence-expression-in-computed-property.js');
584+
585+
obfuscatedCode = JavaScriptObfuscator.obfuscate(
586+
code,
587+
{
588+
...NO_ADDITIONAL_NODES_PRESET
589+
}
590+
).getObfuscatedCode();
591+
});
592+
593+
it('should generate a valid js code', () => {
594+
assert.match(obfuscatedCode, regExp);
595+
});
596+
});
597+
574598
describe('new.target MetaProperty', () => {
575599
const regExp: RegExp = /new\.target *=== *Foo/;
576600

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Foo {
2+
[(bar, baz)]() {}
3+
}

yarn.lock

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -419,41 +419,42 @@
419419
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.15.2.tgz#927997342bb9f4a5185a86e6579a0a18afc33b0a"
420420
integrity sha512-67ZgZpAlhIICIdfQrB5fnDvaKFcDxpKibxznfYRVAT4mQE41Dido/3Ty+E3xGBmTogc5+0Qb8tWhna+5B8z1iQ==
421421

422-
"@typescript-eslint/eslint-plugin@3.3.0":
423-
version "3.3.0"
424-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.3.0.tgz#89518e5c5209a349bde161c3489b0ec187ae5d37"
425-
integrity sha512-Ybx/wU75Tazz6nU2d7nN6ll0B98odoiYLXwcuwS5WSttGzK46t0n7TPRQ4ozwcTv82UY6TQoIvI+sJfTzqK9dQ==
422+
"@typescript-eslint/eslint-plugin@3.4.0":
423+
version "3.4.0"
424+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.4.0.tgz#8378062e6be8a1d049259bdbcf27ce5dfbeee62b"
425+
integrity sha512-wfkpiqaEVhZIuQRmudDszc01jC/YR7gMSxa6ulhggAe/Hs0KVIuo9wzvFiDbG3JD5pRFQoqnf4m7REDsUvBnMQ==
426426
dependencies:
427-
"@typescript-eslint/experimental-utils" "3.3.0"
427+
"@typescript-eslint/experimental-utils" "3.4.0"
428+
debug "^4.1.1"
428429
functional-red-black-tree "^1.0.1"
429430
regexpp "^3.0.0"
430431
semver "^7.3.2"
431432
tsutils "^3.17.1"
432433

433-
"@typescript-eslint/experimental-utils@3.3.0":
434-
version "3.3.0"
435-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.3.0.tgz#d72a946e056a83d4edf97f3411cceb639b0b8c87"
436-
integrity sha512-d4pGIAbu/tYsrPrdHCQ5xfadJGvlkUxbeBB56nO/VGmEDi/sKmfa5fGty5t5veL1OyJBrUmSiRn1R1qfVDydrg==
434+
"@typescript-eslint/experimental-utils@3.4.0":
435+
version "3.4.0"
436+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz#8a44dfc6fb7f1d071937b390fe27608ebda122b8"
437+
integrity sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw==
437438
dependencies:
438439
"@types/json-schema" "^7.0.3"
439-
"@typescript-eslint/typescript-estree" "3.3.0"
440+
"@typescript-eslint/typescript-estree" "3.4.0"
440441
eslint-scope "^5.0.0"
441442
eslint-utils "^2.0.0"
442443

443-
"@typescript-eslint/parser@3.3.0":
444-
version "3.3.0"
445-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.3.0.tgz#fcae40012ded822aa8b2739a1a03a4e3c5bbb7bb"
446-
integrity sha512-a7S0Sqn/+RpOOWTcaLw6RD4obsharzxmgMfdK24l364VxuBODXjuJM7ImCkSXEN7oz52aiZbXSbc76+2EsE91w==
444+
"@typescript-eslint/parser@3.4.0":
445+
version "3.4.0"
446+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.4.0.tgz#fe52b68c5cb3bba3f5d875bd17adb70420d49d8d"
447+
integrity sha512-ZUGI/de44L5x87uX5zM14UYcbn79HSXUR+kzcqU42gH0AgpdB/TjuJy3m4ezI7Q/jk3wTQd755mxSDLhQP79KA==
447448
dependencies:
448449
"@types/eslint-visitor-keys" "^1.0.0"
449-
"@typescript-eslint/experimental-utils" "3.3.0"
450-
"@typescript-eslint/typescript-estree" "3.3.0"
450+
"@typescript-eslint/experimental-utils" "3.4.0"
451+
"@typescript-eslint/typescript-estree" "3.4.0"
451452
eslint-visitor-keys "^1.1.0"
452453

453-
"@typescript-eslint/typescript-estree@3.3.0":
454-
version "3.3.0"
455-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.3.0.tgz#841ffed25c29b0049ebffb4c2071268a34558a2a"
456-
integrity sha512-3SqxylENltEvJsjjMSDCUx/edZNSC7wAqifUU1Ywp//0OWEZwMZJfecJud9XxJ/40rAKEbJMKBOQzeOjrLJFzQ==
454+
"@typescript-eslint/typescript-estree@3.4.0":
455+
version "3.4.0"
456+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz#6a787eb70b48969e4cd1ea67b057083f96dfee29"
457+
integrity sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw==
457458
dependencies:
458459
debug "^4.1.1"
459460
eslint-visitor-keys "^1.1.0"
@@ -1852,10 +1853,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
18521853
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
18531854
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
18541855

1855-
escodegen@1.14.2:
1856-
version "1.14.2"
1857-
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.2.tgz#14ab71bf5026c2aa08173afba22c6f3173284a84"
1858-
integrity sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A==
1856+
escodegen@1.14.3:
1857+
version "1.14.3"
1858+
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503"
1859+
integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==
18591860
dependencies:
18601861
esprima "^4.0.1"
18611862
estraverse "^4.2.0"
@@ -1999,10 +2000,10 @@ eslint-visitor-keys@^1.2.0:
19992000
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa"
20002001
integrity sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ==
20012002

2002-
eslint@7.3.0:
2003-
version "7.3.0"
2004-
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.0.tgz#f9f1fc3dc1227985d0db88769f2bbac7b4b875d7"
2005-
integrity sha512-dJMVXwfU5PT1cj2Nv2VPPrKahKTGdX+5Dh0Q3YuKt+Y2UhdL2YbzsVaBMyG9HC0tBismlv/r1+eZqs6SMIV38Q==
2003+
eslint@7.3.1:
2004+
version "7.3.1"
2005+
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.1.tgz#76392bd7e44468d046149ba128d1566c59acbe19"
2006+
integrity sha512-cQC/xj9bhWUcyi/RuMbRtC3I0eW8MH0jhRELSvpKYkWep3C6YZ2OkvcvJVUeO6gcunABmzptbXBuDoXsjHmfTA==
20062007
dependencies:
20072008
"@babel/code-frame" "^7.0.0"
20082009
ajv "^6.10.0"
@@ -5066,10 +5067,10 @@ text-table@^0.2.0:
50665067
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
50675068
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
50685069

5069-
threads@1.6.1:
5070-
version "1.6.1"
5071-
resolved "https://registry.yarnpkg.com/threads/-/threads-1.6.1.tgz#85aef3f18b1f17c97b4535490550a57683dc113e"
5072-
integrity sha512-khaJCx6WnMHWdJo+8cANhnLYTbfO+Lv9ObvrI9QoxhRoMziB24Lbv3NoHNli+rJRzbO7BvPqsq3/icebeL30uA==
5070+
threads@1.6.2:
5071+
version "1.6.2"
5072+
resolved "https://registry.yarnpkg.com/threads/-/threads-1.6.2.tgz#ef91053910a084aa99a1f460cb9978f577596d6f"
5073+
integrity sha512-SB3yJ3WcwGWYYsUg1Wg9IhQ88BUq1JwZlQsaBgmolSqet5wiBaFhg8cyfHFbHGRElZ/sl4bahrrSEz3Odmr1Vg==
50735074
dependencies:
50745075
callsites "^3.1.0"
50755076
debug "^4.1.1"

0 commit comments

Comments
 (0)
0