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

通过在代码图上遍历实现可扩展的缺陷检测

Scalable Defect Detection via Traversal on Code Graph

Zhengyao Liu, Xitong Zhong, Xingjing Deng, Shuo Hong, Xiang Gao, Hailong Sun

AI总结:

针对代码属性图规模大、查询规则过具体导致静态分析难以扩展的问题,提出 QVoG 平台,通过压缩 CPG、声明式查询和机器学习提升效率与通用性。

摘要:

在早期阶段检测缺陷和漏洞长期以来一直是软件工程中的一项挑战。静态分析是一种无需执行即可检查代码的技术,已成为应对这一挑战的关键策略。在近期进展中,基于图的表示(尤其是 Code Property Graph,CPG,代码属性图)的使用因其对代码结构和语义的全面刻画而受到关注。尽管取得了进展,现有基于图的分析工具仍面临性能和可扩展性问题。主要瓶颈在于 CPG 的规模和复杂性,这使得分析大型代码库效率低下且消耗内存。此外,当前工具使用的查询规则可能过于具体。因此,我们提出 QVoG,这是一个用于检测缺陷和漏洞的基于图的静态分析平台。它采用压缩的 CPG 表示以维持合理的图规模,从而提升整体查询效率。基于 CPG,它还提供一种声明式查询语言以简化查询。此外,它进一步集成机器学习以增强漏洞检测的通用性。对于由超过 1,000,000 行代码组成的项目,QVoG 可在约 15 分钟内完成分析,而 CodeQL 需要 19 分钟。

英文摘要:

Detecting defects and vulnerabilities in the early stage has long been a challenge in software engineering. Static analysis, a technique that inspects code without execution, has emerged as a key strategy to address this challenge. Among recent advancements, the use of graph-based representations, particularly Code Property Graph (CPG), has gained traction due to its comprehensive depiction of code structure and semantics. Despite the progress, existing graph-based analysis tools still face performance and scalability issues. The main bottleneck lies in the size and complexity of CPG, which makes analyzing large codebases inefficient and memory-consuming. Also, query rules used by the current tools can be over-specific. Hence, we introduce QVoG, a graph-based static analysis platform for detecting defects and vulnerabilities. It employs a compressed CPG representation to maintain a reasonable graph size, thereby enhancing the overall query efficiency. Based on the CPG, it also offers a declarative query language to simplify the queries. Furthermore, it takes a step forward to integrate machine learning to enhance the generality of vulnerability detection. For projects consisting of 1,000,000+ lines of code, QVoG can complete analysis in approximately 15 minutes, as opposed to 19 minutes with CodeQL.

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

↑