Skip to content

An information-retrieval-based approach to recover the variable names in minified JS code by searching for them in a large corpus of open-source

Notifications You must be signed in to change notification settings

trunghieu-tran/RecoverJSName-JSNeat

Repository files navigation

Recovering Variable Names for Minified Code with Usage Contexts - JSNeat

JSNeat - an information retrieval (IR)- based approach to recover the variable names in minified JS code. JSNEAT follows a data-driven approach to recover names by searching for them in a large corpus of open-source JS code.

Website

Official website : https://mrstarrynight.github.io/JSNeat/

Publication

This project is published on The International Conference on Software Engineering 2019 (ICSE 2019)

Slide

The presentation of the project in ICSE'2019 could be download here

Why do we create JSNeat?

In modern Web development, program understanding plays an equally important role. Web technologies and programming languages require the exposure of source code to Web browsers in the client side to be executed there. To avoid such exposure, the source code such as JavaScript (JS) files are often obfuscated in which the variable names are minified, i.e., the variable names are replaced with short, opaque, and meaningless names. The intention has two folds. First, it makes the JS files smaller and thus are quickly loaded to improve performance. Second, minification diminishes code readability for the readers, while maintaining the program semantics. Due to those reasons, there is a natural need to automatically recover the minified code with meaningful variable names. That's why JSNeat was born.

Techniques

The names of the variables in a particular function not only depend on the task in which the variable is used to implement (called task- specific context), but their names are also affected by their own properties and roles in the code (called single-variable usage context) and on the names of the other variables in the same function (called multiple-variable usage context):

  • Single-variable usage context (SVC)
  • Multiple-variable usage context (MVC)
  • Task-specific context (TSC)

Empirical Result

In this experiment, we evaluate JSNEAT’s accuracy and compare it with the state-of-the-art approaches JSNice and JSNaughty.

Accuracy Comparison

alt text

Overlapping among Results from Three Tools

alt text

All experiments were run on a Linux computer server with twenty Intel Xeon 2.2GHz processors, 256GB RAM.

alt text

Corpus

We collected a corpus of 12,000 open-source JavaScript projects from GitHub with highest ratings. Download links: Corpus

Contributors

About

An information-retrieval-based approach to recover the variable names in minified JS code by searching for them in a large corpus of open-source

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published