到底是谁的错?SILC:LLM 生成代码的安全集成
Whose fault is it anyway? SILC: Safe Integration of LLM-Generated Code
AI总结:
提出 SILC 框架,利用增强的 Incorrectness Separation Logic 定位多组件集成中的内存安全故障并分配清理义务,实证验证其可识别 AI 生成代码的安全问题。
摘要:
在现代软件开发中,通常会将来自不同贡献者(包括 AI 助手)的多个软件组件组合起来,以构建一个内聚的系统。尽管这些组件各自可能都是安全的,但其组合却未必安全。该问题的核心往往是各组件所做的需求与假设之间存在不一致。一旦发现这种情况,重要的是确定哪个组件应对解决该不一致问题负责,并防止其未来再次发生。在本文中,我们提出了 SILC,这是一个用于定位故障(即归责)并分配清理义务的框架,以防止由多个软件组件组合而导致的内存问题。具体而言,我们展示了 Incorrectness Logic 在自动提取自动生成代码中隐含的非功能假设,并将这些假设显式化,从而检测其与现有代码中需求不一致方面所能发挥的作用。换言之,我们从关注安全属性而非以功能为中心的传统方法这一视角来审视代码理解问题。为此,我们增强了 Incorrectness Separation Logic,使其具备故障跟踪和清理插入能力。我们通过在来自开源项目的数百万行代码上运行实验来展示该框架的优势;在这些实验中,现有功能的部分内容由 AI 助手重新生成。我们通过实证表明,AI 助手会生成不安全的代码,并证明了我们的框架在提出适当归责和清理义务方面的实用性。
英文摘要:
In modern software development, multiple software components, often sourced from different contributors, including AI assistants, are combined to create a cohesive system. Although these components might each be individually safe, their composition might not be so. At the core of this issue is often a misalignment between the requirements and assumptions made by each component. Once discovered it is important to determine which component is accountable for addressing the misalignment issue and to prevent its occurrence in the future. In this work we propose SILC, a framework for localising fault, i.e. blame, and for assigning sanitization obligations to prevent memory issues resulting from the composition of multiple software components. In particular, we show the role Incorrectness Logic could have in automatically extracting implicit non-functional assumptions in auto-generated code and render them explicit in order to detect misalignment with the requirements in existing code. In other words, we are looking at the problem of code comprehension from a perspective focused on safety properties rather than the traditional approach centered on functionality. To do that, we enhance Incorrectness Separation Logic with capabilities for fault tracking and sanitization insertion. We show the benefits of this framework by running experiments on millions of lines of code from open source projects where parts of existing functionality are regenerated by AI assistants. We empirically show that AI assistants produce unsafe code and demonstrate the utility of our framework in proposing appropriate blame and sanitization obligations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。