javascript-deobfuscator icon indicating copy to clipboard operation
javascript-deobfuscator copied to clipboard

Improve scope system

Open ben-sb opened this issue 1 year ago • 0 comments

The current approach to gathering variable declarations and references is too loose and can result in incorrect deobfuscation. Since Shift doesn't provide this for us (like Babel does for example), a proper scope system should be implemented to collect all declarations and references.

Requirements:

  • Correctly handle all declarations and references
    • Including modern features such as object and array destructuring, import and export etc
  • Allow transformations to subscribe to the scope system, and request for the declarations and references to be updated
    • Could alternatively handle scopes once, then have each transformation register any changes it has made
      • Downside of this is writing transformations will become tedious

Can use a similar approach to Babel's scope system where we collect all declarations and references in one pass, then link them afterwards. Link

ben-sb avatar Jan 26 '25 18:01 ben-sb