安全导向提示词对报告结果的影响:针对400个AI生成Web应用的对照实验
The Effect of Security-Focused Prompts on Reported Findings: A Controlled Experiment on 400 AI-Generated Web Applications
AI总结:
本研究通过对照实验发现,在智能体编码工具的提示词中添加OWASP安全要求模块,可减少AI生成Web应用的安全发现,但会扩大依赖表面,是低成本的安全改进。
摘要:
智能体编码工具可将规范转化为可运行的Web应用,其默认的认证、会话、输入验证及依赖项设置会成为应用的安全态势。本研究探究在提示词中添加一段与OWASP一致的安全要求固定模块,是否会改变此类工具的输出、改变幅度及伴随的副作用。将100份固定规范各实现4次:2种智能体工具(Claude Code、Codex CLI)与2种提示词组合,提示词共享字节级相同的功能核心,分别为无安全模块的版本A和带安全模块的版本B。用固定的静态与动态管道扫描这400个应用,得到6721项经分类的发现,通过计数、逻辑混合模型及依赖差异分析。该模块使每个应用的发现数量减少1/3(发生率比为0.65,95%置信区间0.60-0.71),两种工具效果一致,且使声明的依赖表面大致翻倍,因此B版本应用携带更多高严重性依赖建议。针对该表面调整后,建议率未上升(每个应用持平,总体降低18%),而第一方源代码中的高严重性发现减少近一半。因此,安全导向提示是一种低成本且可移植的改进,但它扩大了需审计的依赖表面,该效果源于库选择而非安全要求本身。
英文摘要:
Agentic coding tools turn a specification into a running web application, so their defaults for authentication, sessions, input validation, and dependencies become its security posture. This study asks whether appending a fixed block of OWASP-aligned security requirements to the prompt changes what such tools produce, by how much, and with what side effects. Each of 100 frozen specifications was realized four times: two agentic tools (Claude Code, Codex CLI) crossed with two prompts sharing a byte-identical functional core, without (A) and with (B) the security block. A fixed static and dynamic pipeline scanned the 400 applications, yielding 6,721 triaged findings, analyzed with count and logistic mixed models and with a dependency diff. The block cut findings per application by a third (incidence-rate ratio 0.65, 95% CI 0.60-0.71), equally through both tools, and roughly doubled the declared dependency surface, so variant-B applications carried more high-severity dependency advisories. Adjusted for that surface the advisory rate did not rise (flat per application, 18% lower in aggregate), while high-severity findings in first-party source fell by nearly half. Security-focused prompting is therefore an inexpensive and portable improvement, but it enlarges the dependency surface that has to be audited against it, an effect of library selection rather than of the security requirements themselves.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。