Javascript-obfuscator: Issue with two separated obfuscated files on the same page

Created on 22 Jun 2017  路  8Comments  路  Source: javascript-obfuscator/javascript-obfuscator

Hi,

I think I found an issue. I have two independent javascript files on a page, each one obfuscated by the webpack-obfuscator plugin (i.e: different bundles on different <script> tags). Since they both use the same configuration from webpack.conf.js, they have the same seed config and thus the first variable name that is used on the stringArray variable is the same for both obfuscated files. That is an issue as the variable used by stringArray is a global and gets replaced by the second script.
Then somewhere after loading the scripts, any interaction from the first bundle with the stringArray function will look at the second bundle stringArray variable.

Possible workarounds that I could think:

  1. Have the obfuscator output an immediately invoked function that would scope the variable and not leak them to the global scope.
  2. Use the seed parameter plus an hash of the source code as the real seed used by the obuscator. This is not fail-proof as it still might generate two variables with the same name and mess things.

Thanks!

enhancement

All 8 comments

I like second option.

I'll implement it today or tomorrow.

Did it, new beta will be ready in 20 mins.

Hi, check new [email protected]

Thank you very much, will try!

Any news?

Sorry for not reporting before. It does work perfectly as expected, thank you very much!

Nice! I'll close issue than.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qingweiqm picture qingweiqm  路  7Comments

psabharwal123 picture psabharwal123  路  7Comments

olOwOlo picture olOwOlo  路  3Comments

elderapo picture elderapo  路  3Comments

madprops picture madprops  路  5Comments