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

开发者能否依赖LLM进行安全的IaC开发?

Can Developers rely on LLMs for Secure IaC Development?

Technische Universität Clausthal(不伦瑞克工业大学)

Ehsan Firouzi, Shardul Bhatt, Mohammad Ghafari

AI总结:

研究评估了LLM在安全IaC开发中的能力,发现指导提示能显著提高安全异味检测和生成安全代码的效率,但仍有改进空间。

摘要:

我们研究了GPT-4o和Gemini 2.0 Flash在安全的基础设施即代码(IaC)开发中的能力。在包含主要小而简化的代码片段的Stack Overflow数据集上,模型在提示分析代码时从安全角度检测至少71%的安全异味。在带有明确、分步指导提示的情况下,这一比例增加到78%。在包含完整、真实项目脚本的GitHub仓库中,通用提示效果较差,留下超过一半的安全异味未被检测。然而,使用指导提示,模型能够发现至少67%的安全异味。在安全代码生成方面,我们提示LLM使用89个易受攻击的合成场景,并观察到只有7%的生成脚本是安全的。添加生成安全代码的明确指令后,GPT的安全输出率提高到17%,而Gemini变化不大(8%)。这些结果突显了进一步研究以提高LLM在帮助开发者进行安全IaC开发方面的能力的必要性。

英文摘要:

We investigated the capabilities of GPT-4o and Gemini 2.0 Flash for secure Infrastructure as Code (IaC) development. For security smell detection, on the Stack Overflow dataset, which primarily contains small, simplified code snippets, the models detected at least 71% of security smells when prompted to analyze code from a security perspective (general prompt). With a guided prompt (adding clear, step-by-step instructions), this increased to 78%.In GitHub repositories, which contain complete, real-world project scripts, a general prompt was less effective, leaving more than half of the smells undetected. However, with the guided prompt, the models uncovered at least 67% of the smells. For secure code generation, we prompted LLMs with 89 vulnerable synthetic scenarios and observed that only 7% of the generated scripts were secure. Adding an explicit instruction to generate secure code increased GPT secure output rate to 17%, while Gemini changed little (8%). These results highlight the need for further research to improve LLMs' capabilities in assisting developers with secure IaC development.

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

↑