javascript-obfuscator / javascript-obfuscator/gulp-javascript-obfuscator

Parenthesis removed, resulting in altered execution

Open
#26 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
103
Forks
37
PR merge metrics
No merged PRs in 30d

Description

var obj = {val:true}
alert( true  ||  **(**true &&  obj.value == true**)**)  //true
alert( true  ||  true &&  obj.value == true)  //false
 
 becomes
 
var obj = { 'val': !![] };
alert(!![] || !![] && obj['value'] == !![]); //false
alert(!![] || !![] && obj['value'] == !![]); //false

Tested in Adobe ESTK after running Gulp with the following options:
{
compact: false,
controlFlowFlattening: false, //KILLS JSX
deadCodeInjection: false, //KILLS JSX
disableConsoleOutput: false,
identifierNamesGenerator: 'mangled',
renameGlobals: false,
selfDefending: false,
sourceMap: false,
stringArray: false,
rotateStringArray: false,
stringArrayEncoding: false,
splitStrings: false,
transformObjectKeys: false,
unicodeEscapeSequence: false
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two alert expressions through the Gulp plugin using the listed options, then compare the original and generated JavaScript. Check why the parenthesized expression changes behavior and verify the fix by confirming both generated alerts preserve the intended execution result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.