一句话:提出 ConflictJS,用两阶段动态分析与定向测试合成自动检测 JavaScript 库间全局命名空间冲突。
客户端 Web 应用常依赖多个第三方 JavaScript 库,而 JavaScript 缺少命名空间,导致所有库共享全局命名空间,一个库可能无意修改或删除另一个库的 API,引发客户端异常。为此,作者提出 ConflictJS:首先对单个库进行动态分析,找出可能冲突的库对;再通过定向测试合成生成一个会遭受该冲突的客户端应用,从而验证潜在冲突。该方法不产生假阳性,即只在存在真实受害客户端时报告问题。作者用 ConflictJS 分析了 951 个真实库,发现四分之一库潜在冲突,166 个库至少涉及一个确定冲突,冲突会导致崩溃等意外行为。
It is a common practice for client-side web applications to build on various third-party JavaScript libraries. Due to the lack of namespaces in JavaScript, these libraries all share the same global namespace. As a result, one library may inadvertently modify or even delete the APIs of another library, causing unexpected behavior of library clients. Given the quickly increasing number of libraries, manually keeping track of such conflicts is practically impossible both for library developers and users. This paper presents ConflictJS, an automated and scalable approach to analyze libraries for conflicts. The key idea is to tackle the huge search space of possible conflicts in two phases. At first, a dynamic analysis of individual libraries identifies pairs of potentially conflicting libraries. Then, targeted test synthesis validates potential conflicts by creating a client application that suffers from a conflict. The overall approach is free of false positives, in the sense that it reports a problem only when such a client exists. We use ConflictJS to analyze and study conflicts among 951 real-world libraries. The results show that one out of four libraries is potentially conflicting and that 166 libraries are involved in at least one certain conflict. The detected conflicts cause crashes and other kinds of unexpected behavior. Our work helps library developers to prevent conflicts, library users to avoid combining conflicting libraries, and provides evidence that designing a language without explicit namespaces has undesirable effects.
DOI 原文 ·
@inproceedings{paperbot4483,
title = {ConflictJS},
author = {Jibesh Patra and Pooja N. Dixit and Michael Pradel},
booktitle = {ICSE},
year = {2018},
doi = {10.1145/3180155.3180184}
}