vibe coding 完项目后,跑这个 Prompt 做安全审计。
最近 AI 生成的代码安全漏洞频出——API key 硬编码在代码里、SQL 注入没处理、认证逻辑靠 AI 随手写的……很多人 vibe coding 完直接上线,根本没做安全检查。
网友milesdeutscher分享了一个 Claude Code 专用的代码库深度安全审计 Prompt,值得收藏!
Conduct a thorough security audit of this codebase.
Check for:
1. Exposed API keys, secrets, or credentials hardcoded anywhere
2. SQL injection vulnerabilities
3. Authentication and authorization flaws
4. Insecure direct object references
5. Missing input validation or sanitization
6. Sensitive data exposure in logs or error messages
7. Insecure dependencies or outdated packages
8. CORS misconfigurations
9. XSS vulnerabilities
10. Any critical security issues that could lead to data breaches
For each issue found, explain: what it is, where it is, why it's dangerous, and how to fix it. Prioritize by severity.
跑完之后 Claude 会逐条给你列出问题、说明风险等级、给出修复方法。
几个值得注意的地方:
1. API key 泄露是最常见问题。 vibe coding 时 AI 经常把 key 直接写进代码,或者写进被 commit 的配置文件。很多人根本没意识到这件事。
2. 认证逻辑最容易出错。 "帮我加一个登录功能"——AI 给出的实现不一定符合你实际的安全要求,要单独 review。
3. 这不是一次就够的。 每次加了新功能后都应该跑一遍,而不是发布前跑一次交差。
vibe coding 本身没问题,但安全审计这步不能跳过。
#HOW I AI# #程序员#
