Vibe Coding: build real apps with AI · Episode 28. Every agent run below is real: Claude Code 2.1.322 (model claude-opus-5-5) in print mode (claude -p --permission-mode acceptEdits), on 12 November 2026, in /home/asha/projects/class-notes. The agent could write files but needed approval to run commands, and nobody approved, so it never ran its server. We ran every attack ourselves, on our own laptop (localhost), against our own apps. Never test attacks on apps or websites that aren't yours.
Two apps:
- naive-notes (port 3001): written by hand for this video, in the classic tutorial style, to show the classic mistakes. It is not the AI's code.
- class-notes (port 3000): built by Claude Code from a casual prompt.
Phone numbers are masked placeholders (98XXXXXX01); the API key and the password are fake demo values. Tools: Node.js v22, Express 5.3.0, better-sqlite3 13.1.1, npm, Python 3 (sqlite3), Chromium (Playwright) for screenshots.
Sources (read on 12 November 2026): OWASP, Web Frontend Security Cheat Sheet; Firebase, Get started with Cloud Firestore Security Rules.
The problem: "it works" is not "it's safe"
| A house | Your app |
|---|---|
| Doors that open for the family | "It works": tested with friends |
| Doors that lock against strangers | "It's safe": tested with attacks |
| A burglar tries every door and window | An attacker tries every input: forms, URLs, scripts. One weak spot is enough. |
The obvious way (naive-notes, written by hand)
// The OBVIOUS way, written by hand for this video: it works... and it's unsafe.
const express = require("express");
const Database = require("better-sqlite3");
const db = new Database(":memory:");
db.exec("CREATE TABLE notes (id INTEGER PRIMARY KEY, name TEXT, body TEXT)");
db.exec("CREATE TABLE students (id INTEGER PRIMARY KEY, name TEXT, phone TEXT)");
db.exec("INSERT INTO students (name, phone) VALUES ('Asha', '98XXXXXX01'), ('Ravi', '98XXXXXX02'), ('Neha', '98XXXXXX03')");
const app = express();
app.use(express.json());
app.use(express.static("public"));
app.get("/api/notes", (req, res) => {
const q = req.query.q || "";
const sql = "SELECT * FROM notes WHERE body LIKE '%" + q + "%' ORDER BY id DESC";
res.json(db.prepare(sql).all());
});
app.post("/api/notes", (req, res) => {
db.prepare("INSERT INTO notes (name, body) VALUES ('" + req.body.name + "', '" + req.body.body + "')").run();
res.status(201).json({ ok: true });
});
app.delete("/api/notes/:id", (req, res) => {
db.prepare("DELETE FROM notes WHERE id = " + req.params.id).run();
res.json({ deleted: req.params.id });
});
app.listen(3001, () => console.log("naive notes on http://localhost:3001"));
public/app.js of the naive app:
const AI_API_KEY = "sk-FAKE-demo-0000-not-a-real-key"; // for the "summarize" button
async function load() {
const notes = await (await fetch("/api/notes")).json();
document.getElementById("notes").innerHTML = notes
.map((n) => `<li><b>${n.name}</b>: ${n.body}</li>`)
.join("");
}
load();
SQL (Structured Query Language) is the language for asking a database for data. Here user input is glued into SQL text with +.
1. SQL injection
The innocent symptom (real)
$ curl -s -X POST localhost:3001/api/notes -H Content-Type:application/json -d '{"name":"Anil D'"'"'Souza","body":"Who has the chemistry notes?"}'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>SqliteError: near "Souza": syntax error<br> at Database.prepare (.../better-sqlite3/lib/methods/wrappers.js:5:21)<br> at /home/asha/projects/naive-notes/server.js:18:6 ...</pre>
</body>
</html>
The apostrophe in D'Souza ended the text inside the SQL early. (Also notice: the error page shows file paths from the server. That's Express's default in development; production apps should show a plain "Something went wrong".) If a name can break the query by accident, a crafted input can rewrite it on purpose.
Slowly, in Python (run in the compiler)
import sqlite3
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE notes (name TEXT, body TEXT)")
db.execute("CREATE TABLE students (name TEXT, phone TEXT)")
db.execute("INSERT INTO notes VALUES ('Neha', 'Maths test moved to Friday')")
db.execute("INSERT INTO students VALUES ('Asha', '98XXXXXX01'), ('Ravi', '98XXXXXX02')")
def search_unsafe(word):
sql = "SELECT name, body FROM notes WHERE body LIKE '%" + word + "%'"
print("SQL:", sql)
return db.execute(sql).fetchall()
def search_safe(word):
sql = "SELECT name, body FROM notes WHERE body LIKE ?"
return db.execute(sql, ("%" + word + "%",)).fetchall()
attack = "zzz' UNION SELECT name, phone FROM students --"
print(search_unsafe("Maths"))
print(search_unsafe(attack))
print("safe:", search_safe(attack))
Output:
SQL: SELECT name, body FROM notes WHERE body LIKE '%Maths%'
[('Neha', 'Maths test moved to Friday')]
SQL: SELECT name, body FROM notes WHERE body LIKE '%zzz' UNION SELECT name, phone FROM students --%'
[('Asha', '98XXXXXX01'), ('Ravi', '98XXXXXX02')]
safe: []
- The
'closed the text;UNION SELECT ...added a second question ("also give me names and phones from students");--turned the rest into a comment. - SQL injection = user input that changes your SQL command.
- The fix: a parameterised query: a
?placeholder in the SQL, and the value passed separately. The database treats it only as data, never as SQL.
The same attack on both web apps (real)
$ curl -s -G localhost:3001/api/notes --data-urlencode "q=zzz%' UNION SELECT id, name, phone FROM students --"
[{"id":1,"name":"Asha","body":"98XXXXXX01"},{"id":2,"name":"Ravi","body":"98XXXXXX02"},{"id":3,"name":"Neha","body":"98XXXXXX03"}]
$ curl -s -G localhost:3000/api/notes --data-urlencode "q=zzz%' UNION SELECT id, name, phone FROM students --"
[]
The AI's search (from class-notes/server.js):
// Escape LIKE wildcards so searching for "%" or "_" matches literally.
const pattern = '%' + q.replace(/[\\%_]/g, (c) => '\\' + c) + '%';
rows = db
.prepare(
`SELECT ${cols} FROM notes
WHERE body LIKE ? ESCAPE '\\' OR name LIKE ? ESCAPE '\\'
ORDER BY id DESC`
)
.all(pattern, pattern);
(${cols} is a fixed list of column names written in the code, not user input, so it's safe there.)
2. XSS: a note that runs code
Ravi posted this note on both apps:
<img src=x onerror="document.querySelector(`h1`).textContent=`This page just ran code from a note`;document.body.style.background=`#ffd6d6`">
- Naive page: the heading changed to "This page just ran code from a note" and the background went pink. The browser treated the note as part of the page; the image failed to load, so its
onerrorJavaScript ran. - AI's page: the note appears as plain text.
Cross-site scripting (XSS) = an attacker gets their script to run in other people's browsers, through your site. A real script could read what the page stores in the browser (here: the secret delete codes) or act as the user.
The one line that decides it:
// naive-notes/public/app.js
document.getElementById("notes").innerHTML = notes
.map((n) => `<li><b>${n.name}</b>: ${n.body}</li>`)
.join("");
// class-notes (the AI's page)
// Build DOM with textContent only, so notes can't inject HTML/scripts.
p.textContent = n.body;
OWASP's cheat sheet: textContent "treats inserted HTML tags as literal text and does not parse them." and "The fundamental security rule is to never use innerHTML with untrusted data."
3. Missing authorization checks (real)
$ curl -s -X DELETE localhost:3001/api/notes/1
{"deleted":"1"}
$ curl -s -X DELETE localhost:3000/api/notes/1
{"error":"You can only delete your own notes."}
Authentication = proving who you are (logging in). Authorization = checking what you're allowed to do. The naive server never asks "is this person allowed?". The AI's version gives each new note a random delete token (a secret code) that only the poster's browser keeps; the server compares it before deleting (with crypto.timingSafeEqual, a comparison that takes the same time whether the first or last character is wrong, so it leaks nothing).
4. Leaked secrets
$ curl -s localhost:3001/app.js | grep KEY
const AI_API_KEY = "sk-FAKE-demo-0000-not-a-real-key"; // for the "summarize" button
Anything sent to the browser can be read by anyone (View Source, DevTools, or one command). A key there lets strangers use the service on your bill. Keys stay on the server, in .env (gitignored, see episode 26), never in front-end code, never in Git.
Secrets typed into prompts (real)
In prompt 2 below we typed the teacher's password into the prompt. The AI kept it out of the code, but:
$ grep -l "chai@1234" ~/.claude/projects/-home-asha-projects-class-notes/*.jsonl
/root/.claude/projects/-home-asha-projects-class-notes/4484ca7c-5227-4f7b-bee7-3058e2a0f37e.jsonl
$ cat .env
ADMIN_PASSWORD=chai@1234
The agent saves each conversation on the computer, and the prompt was sent to the AI service. Never type a real password or key into a prompt; write "the password is in .env as ADMIN_PASSWORD" and fill the file yourself.
The AI's version
Prompt 1 (real)
claude -p "Build a quick notes board for our class. server.js with Express and better-sqlite3 (already installed), and a page in public/. Students type their name and a note and post it. Show all notes newest first, with a search box to find notes by a word. Each student can delete notes. Keep it simple, it's just for our class." --permission-mode acceptEdits
Reply: "I built the notes board, but I haven't run it. The commands to start the server and test it needed approval, so it hasn't been started, smoke-tested or even syntax-checked." It also added notes.db* to .gitignore. The full first version of its server.js:
const express = require('express');
const Database = require('better-sqlite3');
const crypto = require('crypto');
const path = require('path');
const db = new Database(path.join(__dirname, 'notes.db'));
db.exec(`
CREATE TABLE IF NOT EXISTS notes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
body TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
delete_token TEXT NOT NULL
)
`);
const app = express();
app.use(express.json({ limit: '10kb' }));
app.use(express.static(path.join(__dirname, 'public')));
const MAX_NAME = 50;
const MAX_BODY = 1000;
// List notes, newest first. Optional ?q=word filters by name or note text.
app.get('/api/notes', (req, res) => {
const q = typeof req.query.q === 'string' ? req.query.q.trim() : '';
const cols = 'id, name, body, created_at';
let rows;
if (q) {
// Escape LIKE wildcards so searching for "%" or "_" matches literally.
const pattern = '%' + q.replace(/[\\%_]/g, (c) => '\\' + c) + '%';
rows = db
.prepare(
`SELECT ${cols} FROM notes
WHERE body LIKE ? ESCAPE '\\' OR name LIKE ? ESCAPE '\\'
ORDER BY id DESC`
)
.all(pattern, pattern);
} else {
rows = db.prepare(`SELECT ${cols} FROM notes ORDER BY id DESC`).all();
}
res.json(rows);
});
// Create a note. Returns a secret delete token that only the poster's browser keeps.
app.post('/api/notes', (req, res) => {
const name = typeof req.body?.name === 'string' ? req.body.name.trim() : '';
const body = typeof req.body?.body === 'string' ? req.body.body.trim() : '';
if (!name || !body) return res.status(400).json({ error: 'Name and note are required.' });
if (name.length > MAX_NAME) return res.status(400).json({ error: `Name must be ${MAX_NAME} characters or fewer.` });
if (body.length > MAX_BODY) return res.status(400).json({ error: `Note must be ${MAX_BODY} characters or fewer.` });
const token = crypto.randomBytes(24).toString('hex');
const info = db
.prepare('INSERT INTO notes (name, body, delete_token) VALUES (?, ?, ?)')
.run(name, body, token);
const note = db.prepare('SELECT id, name, body, created_at FROM notes WHERE id = ?').get(info.lastInsertRowid);
res.status(201).json({ ...note, delete_token: token });
});
// Delete a note — only with the token handed out when it was posted.
app.delete('/api/notes/:id', (req, res) => {
const id = Number(req.params.id);
const token = req.get('X-Delete-Token') || '';
if (!Number.isInteger(id)) return res.status(400).json({ error: 'Bad id.' });
const row = db.prepare('SELECT delete_token FROM notes WHERE id = ?').get(id);
if (!row) return res.status(404).json({ error: 'Note not found.' });
const a = Buffer.from(row.delete_token);
const b = Buffer.from(token);
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(403).json({ error: 'You can only delete your own notes.' });
}
db.prepare('DELETE FROM notes WHERE id = ?').run(id);
res.status(204).end();
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Class notes board running at http://localhost:${PORT}`));
From a prompt that never mentioned security, it used ? placeholders, length limits, textContent and delete tokens. All of the attacks above were blocked.
Prompt 2 (real): an admin page
claude -p "Add an admin page for our class teacher so she can delete any note, including spam. Her password is chai@1234." --permission-mode acceptEdits
It wrote the password to .env ("I put chai@1234 in a new .env file rather than in the code."), added login/logout endpoints with an HttpOnly session cookie (a cookie page scripts can't read), and: "After 5 wrong passwords, logins from that computer are blocked for 15 minutes, so the password can't easily be guessed." The core of its login:
app.post('/api/admin/login', (req, res) => {
if (!ADMIN_PASSWORD) return res.status(503).json({ error: 'Admin login is not set up (ADMIN_PASSWORD missing).' });
const ip = req.ip;
const f = failures.get(ip);
if (f && f.count >= MAX_FAILS && f.until > Date.now()) {
return res.status(429).json({ error: 'Too many wrong attempts. Try again in 15 minutes.' });
}
const password = typeof req.body?.password === 'string' ? req.body.password : '';
if (!safeEqual(password, ADMIN_PASSWORD)) {
const next = f && f.until > Date.now() ? f.count + 1 : 1;
failures.set(ip, { count: next, until: Date.now() + LOCKOUT_MS });
return res.status(401).json({ error: 'Wrong password.' });
}
...
The real AI mistake: a lockout that locks out the teacher
# from a student's browser: 5 guesses
$ for i in 1 2 3 4 5; do curl -s -X POST localhost:3000/api/admin/login -H 'Content-Type: application/json' -d '{"password":"guess'$i'"}'; echo; done
{"error":"Wrong password."}
{"error":"Wrong password."}
{"error":"Wrong password."}
{"error":"Wrong password."}
{"error":"Wrong password."}
# then the teacher, with the RIGHT password
$ curl -s -X POST localhost:3000/api/admin/login -H 'Content-Type: application/json' -d '{"password":"chai@1234"}'
{"error":"Too many wrong attempts. Try again in 15 minutes."}
Why: it counted wrong guesses per IP address (req.ip, the internet address a request comes from). Its reply said "logins from that computer", but at school thirty phones share one WiFi and the server sees one address for all of them. Any student can lock out the teacher, on purpose, any time. A security feature became a weapon.
And no limit on posting (real)
$ time (for i in $(seq 1 300); do curl -s -o /dev/null -w "%{http_code}\n" -X POST localhost:3000/api/notes -H 'Content-Type: application/json' -d '{"name":"spam","body":"BUY FOLLOWERS cheap!!!"}'; done | sort | uniq -c)
300 201
real 0m1.791s
$ curl -s localhost:3000/api/notes | python3 -c "import json,sys; print(len(json.load(sys.stdin)), 'notes on the board')"
301 notes on the board
Rate limiting = a cap on how many requests one user can make in a time window (e.g. 5 notes a minute). The AI built a way to delete spam, but nothing to slow it down.
Prompt 3 (real): the evidence
claude -p "I tested the board on my laptop. Two problems:
1) I typed 5 wrong admin passwords from a second browser, then logged in with the RIGHT password and got: {\"error\":\"Too many wrong attempts. Try again in 15 minutes.\"}. In school the whole class is on the same WiFi, so one student can lock the teacher out.
2) A loop posted 300 notes in 1.8 seconds and every one got 201. Nothing stops spam.
Fix both, keep everything else as it is. Don't add new npm packages." --permission-mode acceptEdits
It changed server.js by +138 / −14 lines: signed cookies, a "trusted browser" cookie for the teacher, per-browser counters, 5 notes a minute and 30 an hour. And it stated its own limits: "In your exact test (a browser that had never logged in), you would still be locked out." … "A deliberate script can still get through more … up to about 300 notes in the first minute … Without accounts, one student behind the shared WiFi can't be told apart from many."
Our retest (real)
# the same 300-note loop
5 201
295 429
# a script that first collects a new cookie (GET /api/notes), then posts 5, 70 times
295 201
55 429
# 5 wrong guesses, then the right password from a new browser
{"error":"Too many wrong attempts from this network. Try again in 15 minutes. (A browser that has logged in as admin before is not affected.)"}
Better, not fixed. Without accounts the server can't tell students apart, so the real fix is a design change: logins (episode 16), so every limit is per person. Don't let an AI keep piling clever patches onto a design problem.
5. Open database rules
Many vibe-coded apps let the browser talk straight to a hosted database (Firebase, Supabase). Then the database's security rules are the only lock. Firebase's "allow all" example:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
Firebase's docs: "NEVER use this rule set in production; it allows anyone to overwrite your entire database." When a permission error blocks you, it's tempting (for you or an AI) to open the rules wide. Before launch, read every allow line: who exactly is allowed?
6. Trusting user input
Input = anything from outside: forms, URLs, files, cookies. Check type and length on the server (the AI: names ≤ 50 characters, notes ≤ 1000). Use ? for SQL and textContent for HTML. Checks in the browser alone don't count: every attack above used curl, with no browser and no form.
7. Dependency risks (real)
Dependencies are packages your app downloads, written by other people. npm audit checks them against a database of known security problems:
asha@laptop:~/projects/class-notes$ npm audit
found 0 vulnerabilities
For comparison, a project with Express 4.17.1 (released in 2019):
$ npm install express@4.17.1
$ npm audit
...
path-to-regexp <=0.1.12
Severity: high
path-to-regexp outputs backtracking regular expressions - https://github.com/advisories/GHSA-9wv6-86v2-598j
path-to-regexp contains a ReDoS - https://github.com/advisories/GHSA-rhx6-c78j-4q9w
...
qs <=6.16.0
Severity: high
qs vulnerable to Prototype Pollution - https://github.com/advisories/GHSA-hrpp-h998-j3pp
...
7 vulnerabilities (3 low, 4 high)
To address all issues, run:
npm audit fix
AI models learned from older code, so check the versions they suggest. Before installing a package an AI names, check it exists, is widely used and is spelled right: attackers publish fake packages with names one letter off (typosquatting).
The security checklist before launch
- [ ] No secrets in code, Git, the browser, or prompts (
.envon the server). - [ ] Every database query uses
?placeholders. - [ ] User text is shown with
textContent(or a sanitiser such as DOMPurify for rich HTML). - [ ] Every change and delete is checked on the server.
- [ ] Logins, and rate limits per user, not per WiFi.
- [ ] Database rules: no
if true. - [ ]
npm auditclean; attack your own app withcurlon your own laptop.
Common mistakes (real)
| Mistake | What you see | Why | Fix |
|---|---|---|---|
| Gluing input into SQL | SqliteError: near "Souza": syntax error; phone numbers in search results |
Input becomes SQL | ? placeholders |
innerHTML with notes |
"This page just ran code from a note" | XSS | textContent |
| Delete with no check | {"deleted":"1"} |
No authorization | Check on the server |
Key in app.js / in a prompt |
curl ... \| grep KEY; password in the chat log |
Browser code and prompts aren't private | .env on the server |
| Lockout per IP (the AI's) | 429 with the right password |
The whole class is one IP | Accounts, limits per user |
| No rate limit | 300 201 in 1.8 s |
Nothing counts requests | Limits per user |
allow read, write: if true |
Anyone can overwrite the database | Rules opened to silence an error | Rules per user |
Mini project
Run the checks on one of your own apps (on your own laptop only):
- Search the code for
innerHTMLand for SQL built with+or${}; fix each withtextContent/?. - Try every delete/update endpoint with
curland no login. Each must be refused. grep -r "KEY\|SECRET\|PASSWORD" public/ src/(front-end folders): nothing should be found.- Run
npm audit(orpip-auditfor Python) and read every high-severity item. - Post 50 requests in a loop: does anything slow you down?
Practice questions
- Why does trimming spaces not protect against SQL injection?
Answer
The attack uses quotes and SQL keywords, not spaces. Only parameterised queries (or strict validation) keep input as data.
- Fix this line:
list.innerHTML += "<li>" + comment + "</li>";
Answer
const li = document.createElement("li");
li.textContent = comment;
list.append(li);
- What's the difference between authentication and authorization? Give an example from this app.
Answer
Authentication: the teacher logs in with her password. Authorization: the server checks that only the teacher (or the note's poster, with its delete token) may delete a note.
- Why was the AI's lockout dangerous at a school?
Answer
It counted failures per IP address; everyone on the school WiFi shares one public IP, so any student's 5 wrong guesses blocked the teacher too.
- Your API key was in
app.jsand the site was live for a day. What now?
Answer
Rotate the key immediately (make a new one, revoke the old), move the call to the server with the key in .env, and check the service's usage for abuse.
Quiz
Which line is safe from SQL injection?
A) "... WHERE name = '" + name + "'" · B) `... WHERE name = '${name}'` · C) prepare("... WHERE name = ?").get(name) · D) "... WHERE name = '" + name.trim() + "'"
Answer
C. Only the ? placeholder keeps the input as data. A, B and D all glue the text into the SQL; trimming removes spaces, not quotes.
Interview questions
- How do parameterised queries prevent SQL injection? The SQL and the values are sent separately; the database never parses the values as SQL.
- Stored vs reflected XSS? Stored: the script is saved (like our note) and shown to everyone. Reflected: it comes from the request (e.g. a URL) and is echoed back.
- Where should rate limits and lockouts be keyed? Per account (or per account + IP), not only per IP, because many users can share one IP (schools, offices, mobile networks).
- How do you keep API keys out of a front end? Call the third-party API from your server; the browser calls your server; the key lives in server environment variables.
- What does npm audit do, and what doesn't it catch? It matches installed package versions with known advisories; it doesn't catch your own bugs, unknown vulnerabilities or malicious packages not yet reported.
Glossary
| Term | Meaning (with an example from this episode) |
|---|---|
| Security | Making an app behave safely even for people who mean harm. |
| Attacker | Someone trying to misuse your app (we played one, on our own laptop). |
| SQL | The language for asking a database for data (SELECT ... FROM notes). |
| SQL injection | User input that changes your SQL command (the UNION SELECT that returned phone numbers). |
UNION |
SQL that adds the rows of a second query to the first. |
SQL comment -- |
Everything after it is ignored; attackers use it to cut off the rest of your query. |
| Parameterised query | SQL with ? placeholders, values passed separately; input stays data. |
| XSS (cross-site scripting) | An attacker's script running in other users' browsers through your site. |
innerHTML |
Inserts text as HTML, so tags inside it become real (dangerous with user text). |
textContent |
Inserts text as plain text; tags are shown, not run. |
onerror |
An HTML attribute whose JavaScript runs when, e.g., an image fails to load. |
| Authentication | Proving who you are (logging in). |
| Authorization | Checking what you're allowed to do (may this user delete this note?). |
| Delete token | A random secret given to a note's poster; needed to delete it. |
| API key | A secret that lets your app use a service; whoever has it can run up your bill. |
.env |
A server-side file of secrets, read by the app, never committed or sent to the browser. |
| Front end / back end | Code that runs in the browser / on your server. |
| Cookie | A small value the browser stores and sends back to the server with each request. |
| HttpOnly cookie | A cookie that page scripts can't read (protects sessions from XSS). |
| Session | A logged-in state the server remembers, usually via a cookie. |
| IP address | The internet address a request comes from; many devices can share one. |
| Lockout | Blocking logins after too many wrong passwords. |
| Rate limiting | Capping how many requests a user can make in a time window. |
| HTTP 201 / 403 / 429 | Created / forbidden / too many requests. |
curl |
A command-line tool to send web requests (no browser, no form checks). |
| Security rules (Firebase) | Rules in the database service that decide who may read/write what. |
| Input validation | Checking the type, length and format of input on the server. |
| Dependency | A package your app uses (express, better-sqlite3). |
npm audit |
Checks installed packages against known vulnerabilities. |
| Vulnerability | A weakness that can be exploited. |
| Typosquatting | Fake packages with names one letter off a popular one. |
Summary
- "It works" is not "it's safe": test like an attacker, on your own laptop.
- SQL injection →
?placeholders. XSS →textContent. Every change is checked on the server. Keys live in.envon the server and never in prompts. - The AI got the classics right from a casual prompt, and still built a lockout keyed by IP that let any student lock out the teacher, and no rate limit. With exact evidence it improved, and honestly said the rest needs accounts.
- Read your database rules, run
npm audit, and use the checklist before launch.
Next episode: Performance and cost: slow pages, image sizes, too many API calls, caching, database indexes, free-tier limits and your AI and hosting bills.