X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Change Log

v5.4.1
---
* Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112

v5.4.0
---
* Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "javascript-obfuscator",
"version": "5.4.0",
"version": "5.4.1",
"description": "JavaScript obfuscator",
"keywords": [
"obfuscator",
Expand All @@ -21,7 +21,7 @@
},
"types": "typings/index.d.ts",
"dependencies": {
"@javascript-obfuscator/escodegen": "2.4.0",
"@javascript-obfuscator/escodegen": "2.4.1",
"@javascript-obfuscator/estraverse": "5.4.0",
"@vercel/blob": ">=0.23.0",
"acorn": "8.15.0",
Expand Down
3 changes: 3 additions & 0 deletions test/functional-tests/issues/fixtures/issue1112.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function(𝐜𝐨𝐧𝐭𝐞𝐱𝐭) {
return 𝐜𝐨𝐧𝐭𝐞𝐱𝐭;
})(42)
39 changes: 39 additions & 0 deletions test/functional-tests/issues/issue1112.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { assert } from 'chai';
import { NO_ADDITIONAL_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
import { readFileAsString } from '../../helpers/readFileAsString';
import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';

//
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112
//
describe('Issue #1112', () => {
describe('Unicode mathematical bold identifiers should have correct spacing after keywords', () => {
let testFunc: () => void;

before(() => {
const code: string = readFileAsString(__dirname + '/fixtures/issue1112.js');

testFunc = () => {
const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, {
...NO_ADDITIONAL_NODES_PRESET,
reservedNames: ['𝐜𝐨𝐧𝐭𝐞𝐱𝐭'],
compact: true,
seed: 1
}).getObfuscatedCode();

const result = eval(obfuscatedCode);

if (result !== 42) {
throw new Error(
`Expected 42, got ${result}. ` +
`Missing space between keyword and Unicode identifier.`
);
}
};
});

it('should produce valid code with Unicode surrogate pair identifiers', () => {
assert.doesNotThrow(testFunc);
});
});
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98"
integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==

"@javascript-obfuscator/escodegen@2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.4.0.tgz#9d2b19b94793106cafa5cd5041c4e40d42943fb7"
integrity sha512-h9cJ/qb3Y3c1jMQPWypt2CGTFgP34V5OtWLqoOCjV6CT/DUXMZFpoTAfDHpuUrRP0oxNd0UwnVAsPtPuYsoXxQ==
"@javascript-obfuscator/escodegen@2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.4.1.tgz#6062541cb3027912e9304dd15f8a5ee5946de247"
integrity sha512-YrEJJDr4cb+pIQKWzHFoDlDkQzatcrNB6OhAD6iTSwiKwzZUMVdobwbOuLpF4EiLxUj0qP28Xl1saTHYzIPCLg==
dependencies:
"@javascript-obfuscator/estraverse" "^5.3.0"
esprima "^4.0.1"
Expand Down
Loading
X Tutup