~/VibeHandbook
$39

18 · 09

回顾与练习

关键要点

  • AI 生成的代码默认就是不安全的;假设漏洞存在并主动去找,而不要相信干净的第一印象。
  • 大类反复出现: 注入、外泄的密钥、缺失的授权、不安全的文件上传,以及凭空发明的依赖。
  • 授权是按请求而非按登录 — 每个接口都必须检查这个用户是否可以执行这个操作,而不只是检查他是否已登录。
  • 每次推送前都跑一次像 gitleaks 这样的密钥扫描器,并轮换任何曾经泄露过的密钥;把扫描接入 ,让你无法跳过。
  • 第九十天比第一天更危险 — 把安全关卡做得便宜到你不会跳过、自动到你无法跳过。

动手试试

挑一个你自己涉及认证、用户数据或上传的功能,对它运行下面这条对抗式审查提示词。对 AI 报告的每个漏洞,索要利用它的确切请求和最小修复,应用修复后再次运行该提示词。最后对仓库和历史记录跑一遍 gitleaks(或你平台内置的密钥扫描)收尾。

本章提示词

Here is the code for a feature that handles [auth / user data / uploads]:
[paste the code].
Act as an attacker reviewing this for security holes. Specifically check:
  - broken authorization (can a user act on another user's data?)
  - injection via input (SQL injection, XSS, command injection)
  - exposed secrets or keys in code or responses
  - unsafe file handling (type, size, path, generated names)
  - missing validation or rate limits
For EACH issue, show the exact request that exploits it, then the fix.
Do NOT reassure me — assume there IS a vulnerability and find it.

想离线阅读?

获取 PDF + EPUB + 可下载的提示词库 + 版本更新。

$ 获取 PDF — $39