skip to main content
10.1145/3468264.3468556acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
research-article

Accelerating JavaScript static analysis via dynamic shortcuts

Published: 18 August 2021 Publication History

Abstract

JavaScript has become one of the most widely used programming languages for web development, server-side programming, and even micro-controllers for IoT. However, its extremely functional and dynamic features degrade the performance and precision of static analysis. Moreover, the variety of built-in functions and host environments requires excessive manual modeling of their behaviors. To alleviate these problems, researchers have proposed various ways to leverage dynamic analysis during JavaScript static analysis. However, they do not fully utilize the high performance of dynamic analysis and often sacrifice the soundness of static analysis. In this paper, we present dynamic shortcuts, a new technique to flexibly switch between abstract and concrete execution during JavaScript static analysis in a sound way. It can significantly improve the analysis performance and precision by using highly-optimized commercial JavaScript engines and lessen the modeling efforts for opaque code. We actualize the technique via SAFEDS, an extended combination of SAFE and Jalangi, a static analyzer and a dynamic analyzer, respectively. We evaluated SAFEDS using 269 official tests of Lodash 4 library. Our experiment shows that SAFEDS is 7.81x faster than the baseline static analyzer, and it improves the precision to reduce failed assertions by 12.31% on average for 22 opaque functions.

References

[1]
2020. Electron - A framework for cross-platform desktop apps with JavaScript, HTML, and CSS. https://www.electronjs.org/
[2]
2020. Espruino - An open-source JavaScript interpreter for microcontrollers. https://www.espruino.com/
[3]
2020. Lodash - A modern JavaScript library delivering modularity, performance, and extras. https://lodash.com/
[4]
2020. Moddable - Tools to create open IoT products using standard JavaScript on low cast microcontrollers. https://www.moddable.com/
[5]
2020. Node.js - A JavaScript runtime built on Chrome’s V8 JavaScript engine. https://nodejs.org/
[6]
2020. React Native - A framework for building native apps using React. https://reactnative.dev/
[7]
2020. Standard ECMA-262 6th Edition, ECMAScript 2015 Language Specification. https://262.ecma-international.org/6.0/
[8]
2020. SunSpider Javascript Benchmark. https://webkit.org/perf/sunspider/sunspider.html
[9]
2020. Zoom - A videotelephony software program developed by Zoom Video Communications. https://zoom.us/
[10]
Roberto Amadini, Alexander Jordan, Graeme Gange, François Gauthier, Peter Schachte, Harald Søndergaard, Peter J Stuckey, and Chenyi Zhang. 2017. Combining String Abstract Domains for JavaScript Analysis: An Evaluation. In Proceedings of the 23rd International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS). https://doi.org/10.1007/978-3-662-54577-5_3
[11]
SungGyeong Bae, Hyunghun Cho, Inho Lim, and Sukyoung Ryu. 2014. SAFEWAPI: Web API Misuse Detector for Web Applications. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE). https://doi.org/10.1145/2635868.2635916
[12]
Cristian Cadar, Daniel Dunbar, and Dawson Engler. 2008. KLEE: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs. In Proceedings of the 8th USENIX Symposium on Operating Systems Design and Implementation (OSDI). 8, 209–224. https://dl.acm.org/doi/10.5555/1855741.1855756
[13]
Patrick Cousot and Radhia Cousot. 1977. Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming languages (POPL). https://doi.org/10.1145/512950.512973
[14]
Patrick Cousot and Radhia Cousot. 1992. Abstract interpretation frameworks. Journal of Logic and Computation (JLC), 2, 4 (1992), 511–547. https://doi.org/10.1093/logcom/2.4.511
[15]
Patrice Godefroid, Nils Klarlund, and Koushik Sen. 2005. DART: Directed automated random testing. In Proceedings of the ACM SIGPLAN conference on Programming language design and implementation (PLDI). https://doi.org/10.1145/1065010.1065036
[16]
Patrice Godefroid, Michael Y Levin, and David Molnar. 2012. SAGE: Whitebox Fuzzing for Security Testing. Communications of the ACM (CACM), 55, 3 (2012), 40–44. https://doi.org/10.1145/2093548.2093564
[17]
Liang Gong, Michael Pradel, Manu Sridharan, and Koushik Sen. 2015. DLint: Dynamically Checking Bad Coding Practices in JavaScript. In Proceedings of the 24th International Symposium on Software Testing and Analysis (ISSTA). https://doi.org/10.1145/2771783.2771809
[18]
Stefan Heule, Manu Sridharan, and Satish Chandra. 2015. Mimic: Computing Models for Opaque Code. In Proceedings of the 10th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE). https://doi.org/10.1145/2786805.2786875
[19]
Simon Holm Jensen, Anders Møller, and Peter Thiemann. 2009. Type Analysis for JavaScript. In Proceedings of the 16th International Symposium on Static Analysis (SAS). https://doi.org/10.1007/978-3-642-03237-0_17
[20]
Vineeth Kashyap, Kyle Dewey, Ethan A. Kuefner, John Wagner, Kevin Gibbons, John Sarracino, Ben Wiedermann, and Ben Hardekopf. 2014. JSAI: A Static Analysis Platform for JavaScript. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE). https://doi.org/10.1145/2635868.2635904
[21]
Se-Won Kim, Xavier Rival, and Sukyoung Ryu. 2018. A Theoretical Foundation of Sensitivity in an Abstract Interpretation Framework. ACM Transactions on Programming Languages and Systems (TOPLAS), 40, 3 (2018), 1–44. https://doi.org/10.1145/3230624
[22]
James C King. 1976. Symbolic execution and program testing. Communications of the ACM (CACM), 19, 7 (1976), 385–394. https://doi.org/10.1145/360248.360252
[23]
Yoonseok Ko, Xavier Rival, and Sukyoung Ryu. 2017. Weakly Sensitive Analysis for Unbounded Iteration over JavaScript Objects. In Proceedings of the 15th Asian Symposium on Programming Languages and Systems (APLAS). https://doi.org/10.1007/978-3-319-71237-6_8
[24]
Yoonseok Ko, Xavier Rival, and Sukyoung Ryu. 2019. Weakly sensitive analysis for JavaScript object-manipulating programs. Software: Practice and Experience (SPE), 49, 5 (2019), 840–884. https://doi.org/10.1002/spe.2676
[25]
Hongki Lee, Sooncheol Won, Joonho Jin, Junhee Cho, and Sukyoung Ryu. 2012. SAFE: Formal Specification and Implementation of a Scalable Analysis Framework for ECMAScript. In Proceedings of 19th International Workshop on Foundations of Object-Oriented Languages (FOOL).
[26]
Magnus Madsen and Esben Andreasen. 2014. String Analysis for Dynamic Field Access. In Proceedings of the 23rd International Conference on Compiler Construction (CC). https://doi.org/10.1007/978-3-642-54807-9_12
[27]
Matthew Might and Olin Shivers. 2006. Improving Flow Analyses via Γ CFA: Abstract Garbage Collection and Counting. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming (ICFP). https://doi.org/10.1145/1159803.1159807
[28]
Benjamin Barslev Nielsen and Anders Møller. 2020. Value Partitioning: A Lightweight Approach to Relational Static Analysis for JavaScript. In Proceedings of the 34th European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.4230/LIPIcs.ECOOP.2020.16
[29]
Changhee Park, Hyeonseung Im, and Sukyoung Ryu. 2016. Precise and Scalable Static Analysis of jQuery using a Regular Expression Domain. In Proceedings of the 12th Symposium on Dynamic Languages (DLS). https://doi.org/10.1145/2989225.2989228
[30]
Changhee Park, Hongki Lee, and Sukyoung Ryu. 2018. Static analysis of JavaScript libraries in a scalable and precise way using loop sensitivity. Software: Practice and Experience (SPE), 48, 4 (2018), 911–944. https://doi.org/10.1002/spe.2676
[31]
Changhee Park and Sukyoung Ryu. 2015. Scalable and Precise Static Analysis of JavaScript Applications via Loop-Sensitivity. In Proceedings of the 29th European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.4230/LIPIcs.ECOOP.2015.735
[32]
Jihyeok Park. 2014. JavaScript API misuse detection by using typescript. In Proceedings of the companion publication of the 13th international conference on Modularity. https://doi.org/10.1145/2584469.2584472
[33]
Joonyoung Park, Alexander Jordan, and Sukyoung Ryu. 2019. Automatic Modeling of Opaque Code for JavaScript Static Analysis. In Proceedings of the 22nd International Conference on Fundamental Approaches to Software Engineering (FASE). https://doi.org/10.1007/978-3-030-16722-6_3
[34]
Joonyoung Park, Inho Lim, and Sukyoung Ryu. 2016. Battles with False Positives in Static Analysis of JavaScript Web Applications in the Wild. In Proceedings of the 38th IEEE/ACM International Conference on Software Engineering Companion (ICSE-C). https://doi.org/10.1145/2889160.2889227
[35]
Joonyoung Park, Jihyeok Park, Dongjun Youn, and Sukyoung Ryu. 2021. Accelerating JavaScript Static Analysis via Dynamic Shortcuts (Extended Version). arxiv:2105.13699
[36]
Jihyeok Park, Xavier Rival, and Sukyoung Ryu. 2017. Revisiting Recency Abstraction for JavaScript: Towards an Intuitive, Compositional, and Efficient Heap Abstraction. In Proceedings of the 6th ACM SIGPLAN International Workshop on State Of the Art in Program Analysis (SOAP). https://doi.org/10.1145/3088515.3088516
[37]
Jihyeok Park, Yeonhee Ryou, Joonyoung Park, and Sukyoung Ryu. 2017. Analysis of JavaScript Web Applications Using SAFE 2.0. In Proceedings of the 39th IEEE/ACM International Conference on Software Engineering Companion (ICSE-C). https://doi.org/10.1109/ICSE-C.2017.4
[38]
Joonyoung Park, Kwangwon Sun, and Sukyoung Ryu. 2018. EventHandler-Based Analysis Framework for Web Apps Using Dynamically Collected States. In Proceedings of the 21st International Conference on Fundamental Approaches to Software Engineering (FASE). https://doi.org/10.1007/978-3-319-89363-1_8
[39]
Max Schäfer, Manu Sridharan, Julian Dolby, and Frank Tip. 2013. Dynamic Determinacy Analysis. In Proceedings of the 34th annual ACM SIGPLAN conference on Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/2499370.2462168
[40]
Koushik Sen, Swaroop Kalasapur, Tasneem Brutch, and Simon Gibbs. 2013. Jalangi: A Selective Record-Replay and Dynamic Analysis Framework for JavaScript. In Proceedings of the 10th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE). https://doi.org/10.1145/2491411.2491447
[41]
Manu Sridharan, Julian Dolby, Satish Chandra, Max Schäfer, and Frank Tip. 2012. Correlation Tracking for Points-To Analysis of JavaScript. In Proceedings of the 26th European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.1007/978-3-642-31057-7_20
[42]
Benno Stein, Benjamin Barslev Nielsen, Bor-Yuh Evan Chang, and Anders Møller. 2019. Static Analysis with Demand-Driven Value Refinement. In Proceedings of the 34th ACM SIGPLAN conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). https://doi.org/10.1145/3360566
[43]
John Toman and Dan Grossman. 2019. Concerto: A Framework for Combined Concrete and Abstract Interpretation. In Proceedings of the 46th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL). https://doi.org/10.1145/3290356
[44]
Shiyi Wei and Barbara G Ryder. 2013. Practical Blended Taint Analysis for JavaScript. In Proceedings of the 22th International Symposium on Software Testing and Analysis (ISSTA). https://doi.org/10.1145/2483760.2483788

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ESEC/FSE 2021: Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering
August 2021
1690 pages
ISBN:9781450385626
DOI:10.1145/3468264
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 August 2021

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. JavaScript
  2. dynamic analysis
  3. dynamic shortcut
  4. sealed execution
  5. static analysis

Qualifiers

  • Research-article

Funding Sources

  • National Research Foundation of Korea (NRF)

Conference

ESEC/FSE '21
Sponsor:

Acceptance Rates

Overall Acceptance Rate 112 of 543 submissions, 21%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)61
  • Downloads (Last 6 weeks)5
Reflects downloads up to 25 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media