跳到正文
DEV Community· ZeroDev·· 1 小時前AI 評分64

AI 工具編寫的應用程式上線前安全檢查:作者整理五項核對方法

I Scanned My Vibe-Coded App Before Launch — Here's What the Checklist Found

AI 導讀

作者為自己用 AI 編碼工具製作的應用程式進行上線前安全檢查,整理出五項可自行核對的方法。五項檢查包括掃描建置檔中的秘密金鑰、核對資料庫權限、用兩個帳戶測試資料隔離、檢查付款流程,以及預先制定金鑰外洩應變方案。作者另提供包含 19 點清單、Mac、Linux 和 Windows 掃描腳本及 19 份修正範本的付費套裝,售價 $10 一次;清單不等同完整安全審計,也不保證應用程式安全。

正文

I asked an AI coding tool to build my app, and it did. Then I ran a security checklist on it before launch — and found things I could not have spotted by looking at the app, because I don't read code.

This is what I checked, in the order I checked it, and what each check actually looks like when you do it yourself. No jargon, no audit-speak. If you shipped an app with Claude, Cursor, Lovable, or Bolt, you can run the same checks tonight.

1. Scan the build for secret keys

Your app has two kinds of keys. A publishable key is safe to live in the browser. A secret key is a password that lets code spend your money or read your data on your behalf — Stripe, OpenAI, Resend, and others all work this way.

AI coding tools sometimes put a secret key in the code that gets sent to the browser. Anyone can open that file and read it.

The check is a script you run on your build folder — the folder your app is built into, usually called dist. It searches the built files for secret-key patterns and prints one line per finding, like this:

dist/app.js:42: secret-key pattern found

A clean build prints:

OK — no secrets found

If the scan finds a real secret key, don't panic. Replace the key with a new one and cancel the old one (that's called rotating the key), move the key to the server, and run the scan again. It has to print "OK — no secrets found" before you continue.

2. Check who can read your database

Your database is either locked to each user, or open to everyone. There is no middle setting that stays safe by accident.

In Supabase, the setting is called Row Level Security: a rule, row by row, that says who may read or change each row. It has to be on for every table, and the rule for a user's own data has to say the row belongs to that user — not "everyone is allowed".

In Firebase, the same idea lives in the security rules: they should deny by default and only allow each user their own data.

You check this in the dashboard — Supabase shows the status per table, Firebase shows the rules themselves. No code needed, just reading what the dashboard says.

3. Run the two-account test

This is the test that proves the database rules actually work, and it's the last check before launch.

Create two accounts in your app, A and B. Log in as B and try to open A's data — first through the app's own screens, then by calling the app's API directly. B must only see B's own data, or get an access-denied error.

If B can see or change A's data, the test found a real leak. Do not launch. Fix it first.

4. Check the payment path

Three things, before any app takes a payment:

  1. The price is checked on the server. The browser must not decide what something costs — if it does, a buyer can change the price before paying.
  2. Webhooks verify their signature. A webhook is a message Stripe sends your app when a payment succeeds, and your app must check the message's signature — proof it really came from Stripe — before trusting it.
  3. No card data ever touches your server or your logs.

If any of those three fails, fix it before launch, not after the first chargeback.

5. Have a plan for when a key leaks

Keys leak. The question is whether you know the five steps by heart: rotate the key, cancel the old one and anything that used it, check usage and billing for charges you don't recognise, tell your users if their data was affected, and write down what happened.

Write the plan down before launch, not during the incident.

Putting it together

I turned these checks into a pack so I don't rebuild the list for every project: a 19-point checklist written for people who don't read code, secret-scanner scripts for Mac, Linux, and Windows, 19 fix templates — one for every check — with copy-paste snippets, and a README that walks you through it in 15 minutes. It costs $10, once, no subscription.

You can run the same five checks above yourself, tonight, for free. The pack just gives you all 19, in order, with the fix for each one. Vibe-Coded Security Checklist + Fix Pack on Gumroad

This checklist is not a full security audit and does not guarantee your app is secure. It helps you find common issues in vibe-coded apps before launch. If your app handles payments, health data, or children's data, consult a qualified security professional.

來源:DEV Community · dev.to