返回首页

对比阅读

对比阅读:Let AI Write Your Code? I Almost Leaked 2,000 Client Passwords. 与 让 AI 帮你写代码?先看这个 — 我差点把客户密码泄露了

AEN
AI codingsolopreneurnon-developer·

Let AI Write Your Code? I Almost Leaked 2,000 Client Passwords.

Last Wednesday at 3 AM, I almost handed over 2,000 members' data

A friend asked me to help set up a membership system. I had AI write the login code, copy-pasted it, and shipped it live. The next day, the client got weird verification codes. My back went cold.

This isn't a one-off — "AI writes code → direct copy-paste" is a trap

After digging in, I found the AI-generated code had an authorization flaw — anyone could bypass login and access the database directly. I'm not a developer. I didn't see it. AI didn't warn me either.

My buddy Lao Zhang (his WeChat public account is "Lao Zhang Sells Fruit" / 老张卖水果), who runs his own e-commerce site, had AI add payment to his mini-program last month. Within two days, 800 RMB got swiped. The problem: the AI-generated code didn't validate amounts. Amounts could be set to negative.

Not just in China. I follow a UK-based indie developer Simon Willison, who tracks these crash-and-burn cases on his blog. His compiled list shows: from 2024 to now, public "AI-generated code causing security incidents" on GitHub number in the hundreds. The three most common traps:

1. Authorization checks written wrong or missing (this is what bit me)
2. Using outdated encryption methods (AI still recommends MD5 — long obsolete)
3. Putting keys directly in the code (like taping your house key to the front door)

AI isn't trying to hurt you. The code it learned from training data is just mixed quality. AI doesn't understand "security" — it only understands "looks plausible."

Want to dodge this today? Lowest-cost play

If you don't touch code at all and only use existing tools (like Youzan, Weimob, Notion), you can close this tab — nothing to worry about. But if you've had AI write even one snippet for you, keep reading.

- Cost: $0
- Time: 30 minutes
- Technical barrier: You just need to be willing to read a bit
- First step: Open any recent code AI wrote for you, search for these keywords — "password", "admin", "secret", "api_key". If any of them appear in plain text, stop.

A safer move: take the AI-generated code, copy it into another AI to audit it for you. For example, paste what GPT wrote into Claude and ask: "Does this code have any security risks?" Two AIs cross-checking each other — much smaller chance of missing something. But remember: AI auditing AI ≠ real security. The most reliable option is still paying a tech-savvy friend 200 RMB to review it.

Different play for three types of people

If you're just starting out (0 customers): Using AI to write code is fine, but don't use it anywhere involving login, payment, or data. Only use AI for pages, copy, and static content. Once you have your first paying customer, then consider getting someone to review.

If you have 1-2 clients: Spend 30 minutes today, go through all AI-written code in your projects. Anything you're unsure about, roll back to the version without AI. That's exactly what I did — better to move slower than let the client pay for my mistake.

If you're scaling (5+ people / multiple projects): This can't rely on self-discipline — it needs to be baked into the workflow. The mistake I made before was "one person assuming everything's fine." My suggestion: set a rule — any AI-generated code must be reviewed by a second person before deployment. Even if that person is a part-time developer you hire. 500 RMB buys you a peaceful night's sleep.

BZH
AI 写代码独立创业者非程序员·

让 AI 帮你写代码?先看这个 — 我差点把客户密码泄露了

上周三凌晨,我差点把客户 2000 条会员数据送人

我帮朋友搭会员系统,让 AI 写登录代码,复制粘贴就上线。第二天客户收到奇怪验证码,我后背凉了。

这事不是个例 — "AI 写代码 → 直接粘贴"是个坑

排查发现,AI 写的那段代码有权限漏洞,谁都能绕过登录直接访问数据库。我不是程序员,我没看出来,AI 也没提醒我。

我那个做独立站的老张(公众号叫"老张卖水果"),上个月让 AI 给小程序加支付功能,没两天被刷了 800 块。问题就出在 AI 生成的代码没做金额校验,金额能被改成负数。

不只国内。我关注的一个英国独立开发者 Simon Willison,专门在博客上追踪这类翻车案例。他整理的清单显示:2024 年到现在,GitHub 上公开的"AI 生成代码导致安全事故"已经上百起。最常见的三个坑:

1. 权限校验写错或漏写(我栽的就是这个)
2. 用了过期的加密方式(AI 还在推荐 MD5 这种早被淘汰的算法)
3. 把密钥直接写在代码里(等于把家门钥匙贴在门口)

不是 AI 故意害你,是它从训练数据里学来的代码本来就良莠不齐。AI 不懂"安全",它只懂"看起来像那么回事"。

今天想避坑?最低成本方案

如果你完全不碰代码、只用现成工具(比如有赞、微盟、Notion),这篇可以直接关掉,没事。但只要你让 AI 帮你写过哪怕一段代码,往下看。

- :0 元
- 时间:30 分钟
- 技术门槛:会复制粘贴就行,但你得愿意读一读
- 第一步:打开你最近用 AI 写的任何一段代码,搜这几个词——"password"、"admin"、"secret"、"api_key"。明文出现任何一个,先停下来。

更稳的做法:把 AI 写的代码,复制到另一个 AI 里让它帮你审查。比如 GPT 写的丢给 Claude 跑一遍:"这段代码有没有安全风险?" 双 AI 对照着看,漏的概率小很多。但要记住:AI 审 AI ≠ 真的安全。最靠谱还是找个懂技术的朋友花 200 块帮你过一遍。

三类人不同的搞法

如果你是刚起步(0 客户):用 AI 写代码没问题,但别用在涉及登录、支付、数据的任何地方。只拿 AI 写页面、写文案、写静态内容。等你有了第一个付费客户,再考虑找人帮你审。

如果你有 1-2 个客户:今天就花 30 分钟,把你项目里所有 AI 写的代码过一遍。心里没底的,先回滚到不用 AI 的版本。我自己就是这么干的——宁可慢一点,不能让客户替我埋单。

如果你在扩规模(5 人以上 / 多项目):这事不能靠自觉,得进流程。我之前犯过的错就是"一个人想当然"。建议你立个规矩:任何 AI 生成的代码,部署前必须有第二个人 review。哪怕那个人是你花钱请的兼职开发者,500 块能买你一个安稳觉。