Skip to main content
QUICK REVIEW

[论文解读] Enhancing Security Patch Identification by Capturing Structures in Commits

Bozhi Wu, Shangqing Liu|arXiv (Cornell University)|Jul 19, 2022
Software Engineering Research被引用 6
一句话总结

本文提出 E-SPI,一种新颖的深度学习方法,用于自动化安全补丁识别,能够从代码变更和提交信息中捕捉结构化信息。通过在上下文 AST 路径上使用 BiLSTM 表征代码,并在提交信息的依赖图上使用门控图神经网络(GNN),E-SPI 在基准数据集上的准确率比最先进方法高出 4.01%,F1 分数高出 4.42%,在真实部署环境中亦取得进一步提升。

ABSTRACT

With the rapid increasing number of open source software (OSS), the majority of the software vulnerabilities in the open source components are fixed silently, which leads to the deployed software that integrated them being unable to get a timely update. Hence, it is critical to design a security patch identification system to ensure the security of the utilized software. However, most of the existing works for security patch identification just consider the changed code and the commit message of a commit as a flat sequence of tokens with simple neural networks to learn its semantics, while the structure information is ignored. To address these limitations, in this paper, we propose our well-designed approach E-SPI, which extracts the structure information hidden in a commit for effective identification. Specifically, it consists of the code change encoder to extract the syntactic of the changed code with the BiLSTM to learn the code representation and the message encoder to construct the dependency graph for the commit message with the graph neural network (GNN) to learn the message representation. We further enhance the code change encoder by embedding contextual information related to the changed code. To demonstrate the effectiveness of our approach, we conduct the extensive experiments against six state-of-the-art approaches on the existing dataset and from the real deployment environment. The experimental results confirm that our approach can significantly outperform current state-of-the-art baselines.

研究动机与目标

  • 解决开源软件中无声安全补丁识别的关键挑战,即漏洞被修复但未公开披露。
  • 克服现有方法将代码变更与提交信息视为扁平序列的局限,忽略其结构语义。
  • 通过捕捉代码变更中的句法结构与提交信息中的语义依赖关系,提升安全补丁识别能力。
  • 通过引入超出变更代码区域的上下文 AST 路径,增强代码表征,提升模型泛化能力。
  • 在基准数据集与真实部署环境中均验证所提方法的优越性能。

提出的方法

  • 设计一种基于 AST 的代码变更编码器,利用 BiLSTM 学习语义表征,提取代码变更内部及其上下文相关的上下文 AST 路径。
  • 从提交信息构建依赖图,并应用门控图神经网络(GGNN)建模标记级依赖关系,学习上下文化消息表征。
  • 通过集成机制融合学习到的代码与消息表征,提升分类性能。
  • 通过包含连接至变更代码但不局限于其区域的 AST 路径,扩展代码表征,捕捉更广泛的上下文语义。
  • 使用交叉熵损失与 softmax 分类器,端到端训练模型,实现安全补丁的二分类。
  • 利用预训练的代码标记与自然语言词汇嵌入,提升表征质量与模型收敛性。

实验结果

研究问题

  • RQ1通过 AST 路径对代码变更中的结构信息进行建模,是否能超越扁平标记序列,在安全补丁识别中取得更好效果?
  • RQ2依赖解析与图神经网络是否能有效建模提交信息中的语义关系,从而提升补丁检测性能?
  • RQ3在变更代码区域之外引入上下文 AST 路径,是否能增强安全补丁识别的鲁棒性与准确性?
  • RQ4所提出的 E-SPI 模型在受控数据集与真实部署场景中,相较于最先进方法表现如何?
  • RQ5结构建模与上下文表征学习在安全补丁检测整体性能提升中分别起到多大贡献?

主要发现

  • 在基准数据集上,E-SPI 的准确率比最佳基线高出 4.01%,F1 分数高出 4.42%,展现出显著的性能提升。
  • 在真实部署环境中,E-SPI 相比最先进方法,准确率提升 6.03%,F1 分数提升 7.38%。
  • 集成上下文 AST 路径(不仅限于变更代码区域)显著提升了代码表征质量。
  • 在提交信息的依赖图上使用门控图神经网络,有效捕捉了语义依赖关系,优于扁平序列建模方法。
  • 所提方法在多种评估设置下(包括合成数据与真实数据)均持续优于现有方法。
  • 消融实验验证,基于 AST 的代码编码器与基于图的消息编码器均对最终性能有显著贡献,证实了设计选择的有效性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

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