静态 JavaScript 调用图:一项比较研究
Static JavaScript Call Graphs: A Comparative Study
AI总结:
本文系统比较五种静态 JavaScript 调用图构建工具在基准程序与真实 Node.js 模块上的表现,发现 ACG 精确率最高,ACG 与 TAJS 组合可覆盖 99% 真实边并保持 98% 精确率。
摘要:
JavaScript 在客户端和服务器端的普及与广泛采用,使其代码分析比以往任何时候都更加重要。大多数用于漏洞分析、编码问题检测或类型推断的算法都依赖于底层程序的调用图表示。尽管动态分析具有一些明显优势,但在构建调用图时也应考虑静态算法,因为它们不需要为程序配备大量测试平台,也不需要成本高昂的执行和跟踪。本文中,我们在 26 个 WebKit SunSpider 基准测试程序和 6 个真实世界 Node.js 模块上,系统比较了五种被广泛采用的静态算法,这些算法分别由 npm call graph、IBM WALA、Google Closure Compiler、Approximate Call Graph 和 Type Analyzer for JavaScript 工具实现,用于构建 JavaScript 调用图。我们提供了性能分析,以及对结果的定量和定性评估。我们发现,各算法找到的调用边存在相对较大的交集,并且该交集被证明具有 100% 的精确率。然而,大多数工具也找到了其他所有工具都遗漏的边。ACG 的精确率最高,紧随其后的是 TAJS,但 ACG 找到的调用边明显更多。关于工具组合,ACG 与 TAJS 结合覆盖了所有算法找到的真实边的 99%,同时保持高达 98% 的精确率。由于语言特性支持不完整,仅有两个工具能够分析最新的多文件 Node.js 模块。它们在近 60% 的调用边上达成一致,但每个工具都找到了另一个工具遗漏的有效边。
英文摘要:
The popularity and wide adoption of JavaScript both at the client and server side makes its code analysis more important than ever before. Most of the algorithms for vulnerability analysis, coding issue detection, or type inference rely on the call graph representation of the underlying program. Despite some obvious advantages of dynamic analysis, static algorithms should also be considered for call graph construction as they do not require extensive test beds for programs and their costly execution and tracing. In this paper, we systematically compare five widely adopted static algorithms - implemented by the npm call graph, IBM WALA, Google Closure Compiler, Approximate Call Graph, and Type Analyzer for JavaScript tools - for building JavaScript call graphs on 26 WebKit SunSpider benchmark programs and 6 real-world Node.js modules. We provide a performance analysis as well as a quantitative and qualitative evaluation of the results. We found that there was a relatively large intersection of the found call edges among the algorithms, which proved to be 100 precise. However, most of the tools found edges that were missed by all others. ACG had the highest precision followed immediately by TAJS, but ACG found significantly more call edges. As for the combination of tools, ACG and TAJS together covered 99% of the found true edges by all algorithms, while maintaining a precision as high as 98%. Only two of the tools were able to analyze up-to-date multi-file Node.js modules due to incomplete language features support. They agreed on almost 60% of the call edges, but each of them found valid edges that the other missed.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。