arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2506.18191cs.SEcs.AIcs.LG
收藏

Call Me Maybe: 使用图神经网络增强 JavaScript 调用图构建

Call Me Maybe: Enhancing JavaScript Call Graph Construction using Graph Neural Networks

CISPA Helmholtz Center for Information Security(信息安全研究中心)

Masudul Hasan Masud Bhuiyan, Gianluca De Stefano, Giancarlo Pellegrino, Cristian-Alexandru Staicu

AI总结:

针对 JavaScript 调用图构建不准确的问题,提出 GRAPHIA,利用图神经网络在程序图上进行链接预测,识别遗漏的调用边,在 50 个库上实验,将正确目标排进前五的比例达 72%。

摘要:

静态分析在发现错误(包括安全问题)中扮演关键角色。静态分析中的一个关键步骤是构建准确的调用图,以建模程序中的函数调用。然而,由于难以分析的语言特性,现有的 JavaScript 调用图构建算法既不健全也不完备。先前的工作表明,即使是先进的解决方案也会产生错误边并遗漏有效边。在这项工作中,我们通过识别遗漏的调用边来辅助这些工具。我们的主要思想是将问题框架化为完整程序图上的链接预测,使用具有多种边类型的丰富表示。我们的方法 GRAPHIA 利用图神经网络的最新进展来建模代码元素之间的非局部关系。具体来说,我们提出使用基于语法和语义的边的组合来表示 JavaScript 程序。GRAPHIA 可以从不完美的标签中学习,包括来自现有工具的静态调用边和来自测试的动态边,这些边可以来自相同或不同的项目。由于调用图是稀疏的,标准机器学习指标如 ROC 并不适用。相反,我们通过为每个未解析的调用点对函数定义进行排序来评估 GRAPHIA。我们在 50 个流行的 JavaScript 库上进行了大规模评估,包含 163K 条调用边(150K 静态和 13K 动态)。GRAPHIA 构建了具有 6.6M 结构边和 386K 语义边的程序图。它在超过 42% 的未解析案例中将正确目标排为第一候选,在 72% 的案例中排在前五名,从而减少了分析所需的手动工作。我们的结果表明,基于学习的方法可以提高 JavaScript 调用图构建的召回率。据我们所知,这是第一项将基于 GNN 的链接预测应用于完整多文件程序图以进行过程间分析的工作。

英文摘要:

Static analysis plays a key role in finding bugs, including security issues. A critical step in static analysis is building accurate call graphs that model function calls in a program. However, due to hard-to-analyze language features, existing call graph construction algorithms for JavaScript are neither sound nor complete. Prior work shows that even advanced solutions produce false edges and miss valid ones. In this work, we assist these tools by identifying missed call edges. Our main idea is to frame the problem as link prediction on full program graphs, using a rich representation with multiple edge types. Our approach, GRAPHIA, leverages recent advances in graph neural networks to model non-local relationships between code elements. Concretely, we propose representing JavaScript programs using a combination of syntactic- and semantic-based edges. GRAPHIA can learn from imperfect labels, including static call edges from existing tools and dynamic edges from tests, either from the same or different projects. Because call graphs are sparse, standard machine learning metrics like ROC are not suitable. Instead, we evaluate GRAPHIA by ranking function definitions for each unresolved call site. We conduct a large-scale evaluation on 50 popular JavaScript libraries with 163K call edges (150K static and 13K dynamic). GRAPHIA builds program graphs with 6.6M structural and 386K semantic edges. It ranks the correct target as the top candidate in over 42% of unresolved cases and within the top 5 in 72% of cases, reducing the manual effort needed for analysis. Our results show that learning-based methods can improve the recall of JavaScript call graph construction. To our knowledge, this is the first work to apply GNN-based link prediction to full multi-file program graphs for interprocedural analysis.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑