question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with two separated obfuscated files on the same page

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sligcommented, Jun 28, 2017

Thank you very much, will try!

1reaction
sanex3339commented, Jun 28, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

are there any potential issues with obfuscating an application?
There are certainly some potential performance/maintenance issues, but a good obfuscator will let you get round at least some of them.
Read more >
How to fix common obfuscation problems
Possible cause: Mixing obfuscated and non-obfuscated versions of the same JAR(s). Solution: Verify that the classpath only contains the obfuscated JARs.
Read more >
Obfuscation or Encryption for Document Security?
Obfuscation involves a separate program that need to be packaged with a file or executable item to protect them from unauthorized use.
Read more >
Dependent files break after obuscation · Issue #58 - GitHub
To get two dependent files to recognize one another in obfuscated code at runtime, you need to: Put them into the same fileset...
Read more >
Obfuscation Technique - an overview | ScienceDirect Topics
Take two separate code components and interleave their statements in a common procedure. Make multiple copies of a single subroutine to make calling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found