arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.14837cs.SE
收藏

利用全局标识符的唯一性来确定 Python 软件源代码的来源

Using the Uniqueness of Global Identifiers to Determine the Provenance of Python Software Source Code

Yiming Sun, Daniel M. German, Stefano Zacchiroli

AI总结:

针对自由/开源软件源代码的来源识别问题,提出一种基于软件全局标识符的轻量级方法,通过随机选取少量非频繁全局标识符即可高效缩小候选来源范围,在 Debian 与 PyPI 包映射实验中实现了 0.9 的召回率和 0.77 的精确率。

摘要:

我们考虑识别自由/开源软件(FOSS)来源的问题,特别是识别被重用的源代码是从哪里复制来的需求。我们提出了一种基于软件标识符(如程序员选择的变量、类和函数的名称)的轻量级方法来解决该问题。所提出的方法能够高效地缩小范围至一小部分候选原始产品,以便使用成本更高的技术进行进一步分析,从而做出最终的来源判定。通过分析 PyPI(Python Packaging Index)开源生态系统,我们发现全局定义的标识符非常独特。在 PyPI 的 244 K 个包中,我们发现了 11.2 M 个不同的全局标识符(类和方法/函数名称——其中仅有 0.6% 的标识符在这两种实体间共享);76% 的标识符仅在一个包中使用,93% 的标识符最多在 3 个包中使用。从输入产品中随机选择 3 个非频繁的全局标识符,足以在 89% 的情况下将其来源缩小到最多 3 个产品。我们通过将用 Python 实现的 Debian 源代码包映射到相应的 PyPI 包来验证所提出的方法;该方法最多使用五次尝试,每次尝试从目标软件包中随机选择的一个 Python 文件里随机挑选三个全局标识符,然后使用流行度指数对结果进行排名,并且仅需检查排名第一的结果。在我们的实验中,该方法在查找项目的真正来源方面是有效的,召回率为 0.9,精确率为 0.77。

英文摘要:

We consider the problem of identifying the provenance of free/open source software (FOSS) and specifically the need of identifying where reused source code has been copied from. We propose a lightweight approach to solve the problem based on software identifiers-such as the names of variables, classes, and functions chosen by programmers. The proposed approach is able to efficiently narrow down to a small set of candidate origin products, to be further analyzed with more expensive techniques to make a final provenance determination.By analyzing the PyPI (Python Packaging Index) open source ecosystem we find that globally defined identifiers are very distinct. Across PyPI's 244 K packages we found 11.2 M different global identifiers (classes and method/function names-with only 0.6% of identifiers shared among the two types of entities); 76% of identifiers were used only in one package, and 93% in at most 3. Randomly selecting 3 non-frequent global identifiers from an input product is enough to narrow down its origins to a maximum of 3 products within 89% of the cases.We validate the proposed approach by mapping Debian source packages implemented in Python to the corresponding PyPI packages; this approach uses at most five trials, where each trial uses three randomly chosen global identifiers from a randomly chosen python file of the subject software package, then ranks results using a popularity index and requires to inspect only the top result. In our experiments, this method is effective at finding the true origin of a project with a recall of 0.9 and precision of 0.77.

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

↑