Skip to main content
QUICK REVIEW

[论文解读] Static JavaScript Call Graphs: A Comparative Study

Gábor Antal, Péter Hegedűs|arXiv (Cornell University)|May 12, 2024
Web Data Mining and Analysis被引用 8
一句话总结

该论文在 SunSpider 基准和 Node.js 模块上实证比较了五个静态 JavaScript 调用图工具,显示出显著的精度差异,并指出工具组合能够覆盖大多数真实边同时保持高精度。

ABSTRACT

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.

研究动机与目标

  • 评估五个广泛使用的静态 JavaScript 调用图工具的能力和性能。
  • 定量比较各工具在基准和实际输入上产生的边和节点。
  • 通过人工验证定性分析真正的/误取的边并识别各工具的优势与局限性。
  • 提供在高精度下最大化覆盖率的工具组合的指导。

提出的方法

  • 选择五个开源静态 JS 调用图工具(npm callgraph, WALA, Closure Compiler, ACG, TAJS)并将输出适配为统一的 JSON 格式。
  • 在三组输入上运行工具:SunSpider 基准(26 个单文件程序)、六个多文件 Node.js 模块,以及生成的大型 JavaScript 程序。
  • 在需要时对工具进行补丁,以生成一致的 JSON 调用图表示,并解决边重复和目标信息缺失的问题。
  • 将各工具输出合并为带有边-工具来源的组合 JSON 以便比较。
  • 手动验证边的代表性样本(以及 SunSpider 的所有边)以确定真阳性/假阳性。

实验结果

研究问题

  • RQ1各静态调用图工具在 JavaScript 程序上的精度和召回率特征是什么?
  • RQ2工具输出在检测到的调用边上有多大程度的一致性,哪些边是某些工具独自识别的?
  • RQ3将工具组合是否能够在保持高精度的同时实现对真实边的高覆盖率,以及其权衡?
  • RQ4相较于单文件基准,工具在真实多文件 Node.js 模块上的表现如何?

主要发现

  • ACG 具有最高的精度(其报告边中超过 99% 为真边),并且在所有工具找到的真实边并集上也具有最高的召回率(超过 90%)。
  • TAJS 的精度大约为 98%,但在 SunSpider 中没有发现任何唯一边,同时边数也未达到 ACG。
  • 各工具之间的边存在相对较大的交集,五个工具共找到 93 条边,且全部为真阳性。
  • 某些工具(WALA、Closure、npm-cg)报告了很多其他工具未发现的边,但其中许多是误阳性,突显了工具特定的偏差(例如全局作用域调用、动态构造)。
  • 将 ACG 与 TAJS(以及在某种程度上 Closure)的组合覆盖大约 99% 的所有工具所发现的真实边,同时保持约 98% 的精度。
  • 性能和内存使用随输入规模而异;Closure 和 TAJS 在运行时表现出色,而 ACG 和 Closure 在真实输入下往往消耗更多内存,只有 Closure/TAJS/ACG 仍然在非常大规模输入上具有实用性。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。