arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.17853cs.SEcs.PL
收藏

Java 源代码仓库中提交变更的编译

Compilation of Commit Changes within Java Source Code Repositories

Stefan Schott, Wolfram Fischer, Serena Elisa Ponta, Jonas Klauke, Eric Bodden

AI总结:

本文提出 JESS 方法,通过仅编译提交中修改的相关代码并自动推断存根,解决了 Java 项目中修复提交难以编译为字节码的问题,显著提升了漏洞补丁字节码的获取效率。

摘要:

Java 应用程序将第三方依赖项作为字节码包含在内。为了保持这些应用程序的安全性,研究人员提出了重新识别包含已知漏洞的依赖项的工具。然而,为了实现这种重新识别,必须首先为每个漏洞补丁获取修复相应漏洞的字节码。依赖项的这些补丁以修复提交的形式在数据库中进行管理。但是修复提交是源代码形式的,将整个 Java 项目自动编译为字节码是出了名的困难,特别是对于非当前版本的代码。因此,在本文中,我们提出了 JESS,这是一种通过仅编译在给定提交中修改的相关代码来在很大程度上避免此问题的方法。JESS 对代码进行了精简,仅保留提交更改所引用的那些部分。为了避免名称解析错误,JESS 自动为编译器不可用的实体的引用推断出存根。这里的一个挑战是,为了促进上述重新识别,JESS 必须力求生成与成功编译完整项目所获得的字节码几乎相同的字节码。在 347 个 GitHub 项目上的评估表明,JESS 能够独立编译 72% 的方法和构造函数,其中 89% 的字节码与原始字节码相同。此外,在 Project KB 修复提交数据库中,其中只有 8% 在提交中修改的文件可以使用提供的构建脚本进行编译,JESS 能够编译这些提交修改的所有文件中的 73%。

英文摘要:

Java applications include third-party dependencies as bytecode. To keep these applications secure, researchers have proposed tools to re-identify dependencies that contain known vulnerabilities. Yet, to allow such re-identification, one must obtain, for each vulnerability patch, the bytecode fixing the respective vulnerability at first. Such patches for dependencies are curated in databases in the form of fix-commits. But fixcommits are in source code, and automatically compiling whole Java projects to bytecode is notoriously hard, particularly for non-current versions of the code. In this paper, we thus propose JESS, an approach that largely avoids this problem by compiling solely the relevant code that was modified within a given commit. JESS reduces the code, retaining only those parts that the committed change references. To avoid name-resolution errors, JESS automatically infers stubs for references to entities that are unavailable to the compiler. A challenge is here that, to facilitate the above mentioned reidentification, JESS must seek to produce bytecode that is almost identical to the bytecode which one would obtain by a successful compilation of the full project. An evaluation on 347 GitHub projects shows that JESS is able to compile, in isolation, 72% of methods and constructors, of which 89% have bytecode equal to the original one. Furthermore, on the Project KB database of fix-commits, in which only 8% of files modified within the commits can be compiled with the provided build scripts, JESS is able to compile 73% of all files that these commits modify.

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

↑