javascript-obfuscator/javascript-obfuscator

Unicode gets unescaped

Open

#345 建立於 2018年10月25日

在 GitHub 查看
 (3 留言) (2 反應) (0 負責人)TypeScript (12,059 star) (1,413 fork)batch import
PR is welcomedbughelp wantedwontfix

描述

The obfuscator seems to unescape escaped unicode in strings. For example, consider the following input javascript:

console.log("\ud83d\ude03");
console.log("😃");

Expected Behavior

I expect the unicode escape sequences to be preserved. Something like this is expected:

console['log']('\ud83d\ude03');console['log']('😃');

Current Behavior

Escaped characters are unescaped. For the code above, the default obfuscation options produce:

console['log']('😃');console['log']('😃');

Notice the smiley faces appear as unicode characters, that is, they are no longer escaped. Note that if the "Escape Unicode Sequence" option is enabled then that does not happen and instead we get:

console['\x6c\x6f\x67']('\ud83d\ude03');console['\x6c\x6f\x67']('\ud83d\ude03');

However, from my understanding and documentation, this option is not about unescaping unicode, it is about escaping unicode (or escaping everything in general).

Steps to Reproduce (for bugs)

Obfuscate the above code using default configuration on https://obfuscator.io/ .

Your Environment

Used https://obfuscator.io/ .

貢獻者指南

Unicode gets unescaped · javascript-obfuscator/javascript-obfuscator#345 | Good First Issue