安全提示词对AI生成Web应用安全发现的影响:400个应用的对照实验
The Effect of Security-Focused Prompts on Reported Findings: A Controlled Experiment on 400 AI-Generated Web Applications
在100份固定规格上分别用Claude Code与Codex CLI各生成两次,对比追加OWASP安全要求提示词前后的400个Web应用,共得到6,721条分级发现。追加安全提示词使每应用发现数下降约三分之一(发生率比0.65,95% CI 0.60-0.71),两个工具效果相同,第一方源码高危发现减少近半,但声明依赖面约翻倍,高危依赖通告随之增多。
arXiv:2611.28408v1 Announce Type: new Abstract: 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.
来源:arXiv (AI + Vision + Imaging) · arxiv.org