𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆 𝗔𝘂𝗱𝗶𝘁 𝗥𝗲𝘀𝘂𝗹𝘁𝘀: 𝗪𝗵𝘆 𝗜 𝗳𝗲𝗹 𝗲𝗺𝗯𝗮𝗿𝗿𝗮𝘀𝘀𝗲𝗱

I recently ran a security audit on all my side projects. This includes my FastAPI backend, Telegram bots, PWA, and Streamlit apps.

I thought my code was safe because I was careful. I was wrong.

I am sharing these real production bugs to help you avoid them. These are not theoretical checklists. These are mistakes I actually made.

我的新强制性清单:

编码前: • 创建 .gitignore • 创建 .env.example

针对每个端点: • 添加身份验证 • 使用通用的错误信息 • 为高开销任务添加速率限制

提交前: • 在 diff 中扫描密钥信息

部署前: • 对依赖项进行安全审计

安全问题并非偶然发生。它们往往源于那些永远留在生产环境中的 “TODO” 注释和 “临时” 修复方案。

修复 Bug 很枯燥。修复安全漏洞却代价高昂。

来源:https://dev.to/justjinoit/nae-saideu-peurojegteu-boan-gamsa-gyeolgwa-buggeureobjiman-gongyuhabnida-3aj7