Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with two separated obfuscated files on the same page #58

Closed
slig opened this issue Jun 21, 2017 · 8 comments
Closed

Issue with two separated obfuscated files on the same page #58

slig opened this issue Jun 21, 2017 · 8 comments
Milestone

Comments

@slig
Copy link

slig commented Jun 21, 2017

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!

@sanex3339 sanex3339 added this to the 0.10.0 milestone Jun 21, 2017
@sanex3339
Copy link
Member

I like second option.

@sanex3339
Copy link
Member

I'll implement it today or tomorrow.

@sanex3339
Copy link
Member

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

@sanex3339 sanex3339 reopened this Jun 28, 2017
@sanex3339
Copy link
Member

Hi, check new javascript-obfuscator@0.10.0-beta.6

@slig
Copy link
Author

slig commented Jun 28, 2017

Thank you very much, will try!

@sanex3339
Copy link
Member

Any news?

@slig
Copy link
Author

slig commented Jul 3, 2017

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

@sanex3339
Copy link
Member

sanex3339 commented Jul 3, 2017

Nice! I'll close issue than.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants