A security review before launch
Walk Taskboard stack with a launch checklist, covering access control, input, secrets, headers, dependencies, uploads and logs, with findings from running it.
First bottlenecks when traffic growsAuthorization in the API and the UICSRF, XSS and cookie settings across layers
A security review before launch
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- A pre-launch review walks one list across every layer, because a missing check in any layer is enough for an attacker.
- Authorization is the most common serious gap: every route that takes an id must check that the signed-in user may touch that object, not just that someone is signed in.
- Parameterised queries stop injection, but unvalidated parameters still cause errors, so validate path and query values at the boundary.
- Secrets, security headers, dependency audits and logging each get a short, repeatable check you can run before every release.
- Review by trying to break your own app with a second account, a modified id and a hostile string, because reading the code finds fewer holes than attacking the running app.
One pass, every layer
Over this roadmap you built defences one layer at a time: validation, sessions, CORS, cookie flags. A launch review is the moment to ask a different question: if I were trying to break Taskboard, where would I start? The core problem is that security is the weakest link, so a single route without a check undoes ten careful ones.
This is a checklist, in the order I would run it, with what I found when I ran it against the Taskboard API from the earlier lessons. It is not a replacement for a professional review if you hold sensitive data, and it will not find everything. It finds the ordinary mistakes, which are what most real breaches use.
1. Who can read and change what
Start with the thing that fails most often. For every route that takes an id, ask two questions: does it check that the caller is signed in, and does it check that this caller is allowed to touch this object?
I tested the API with no cookie and no header at all, asking for a project by guessing its id:
GET /api/projects/1/tasks -> 200 [{"id":1,"projectId":1,"title":"Fire the CEO","done":false}]
That is the finding. In the early lessons this API had no authentication, which was fine for learning, and the review catches it before launch. The fix has two parts, covered in authorization in the API and the UI: require a session on the route, and add the ownership condition to the query itself, such as where project_id = $1 and exists (select 1 from memberships where user_id = $2 and project_id = $1). Checking only in the UI is not a check. Anyone can call the API directly. This class of bug is called broken object-level authorization and tops the OWASP API list (see OWASP API security top 10).
Test it the way an attacker would: make two accounts, create a project with the first, and request it with the second. Do the same for update and delete, and for nested objects such as comments and attachments. File downloads deserve special attention, since a guessable URL is a public file.
2. Input at the boundary
Every value from outside is hostile until validated: path parameters, query strings, bodies, headers, filenames. I sent three kinds of bad input.
A SQL-shaped task title, x'); drop table tasks;--, returned 201 and the table was intact, with the string stored literally as the title. That is what parameterised queries are for: the value travels separately from the SQL text, so it is never parsed as SQL. Drizzle used bound parameters here. If anywhere in your code builds SQL by concatenating strings, fix that first. See input validation and injection attacks.
A path parameter that is not a number, /api/projects/1%20or%201=1/tasks, returned a 500. Not an injection: Number("1 or 1=1") is NaN, the route passed NaN straight to the query, and Postgres rejected it with invalid input syntax for type integer. The query was safe, but the route trusted its input and the user got an unexplained server error, with the failing query in the logs. Validate path and query values with the same Zod schemas you use for bodies, and return a 400. This is the sort of small gap a review is for.
For anything that renders user text in the browser, check that you never inject it as raw HTML. React escapes by default; the danger is dangerouslySetInnerHTML and markdown renderers. More in CSRF, XSS and cookie settings across layers.
3. Sessions, cookies and sign-in
- Session cookie is
HttpOnly,Secure, and has an explicitSameSitevalue. - Passwords are hashed with a slow hash such as Argon2 or bcrypt, never stored or logged plain. See password hashing and credential storage.
- Login, sign-up and password reset are rate-limited, per account and per address. See rate limiting implementation in your app.
- Error messages for login do not reveal whether an email exists.
- Password reset tokens are random, single-use and expire.
4. Secrets
Search the repository and its history for keys. Check that production secrets exist only in the production environment, that staging uses different ones, and that no VITE_-prefixed variable holds anything private (see deploying the three tiers for why those end up in the public bundle). If a secret was ever committed, rotate it. Deleting it from the file does not remove it from history. See secrets and sensitive data handling.
5. Headers, CORS and transport
I added Hono’s secureHeaders() middleware and looked at what it sent: x-content-type-options: nosniff, x-frame-options: SAMEORIGIN, referrer-policy: no-referrer and strict-transport-security: max-age=15552000; includeSubDomains. These defaults came from Hono 4.13.20 on my run. A Content-Security-Policy is the one that takes thought, and you should write one for the client’s host, because it limits what injected script can do.
CORS should list exact origins, not *, and never reflect whatever Origin arrives while also allowing credentials. Everything runs over HTTPS (see environments, domains and TLS). For the browser view of all this, see web security fundamentals for frontend.
6. Dependencies
Run npm audit and read the output, and turn on automatic dependency updates or alerts for the repository. On the Taskboard test project it printed found 0 vulnerabilities, which says only that no known advisory matched at that moment. Commit the lockfile and install with npm ci, as in continuous integration for a full-stack repo. Be suspicious of new packages with few downloads, a name close to a popular one, or install scripts.
7. Uploads
For attachments, check the declared type and size on the server, not just in the browser. Store files outside the web root in object storage, serve them with a content type you set (never one the uploader chose), and make downloads go through an authorization check or a short-lived signed URL. Do not use the uploaded filename as a path.
8. Logging and errors
Logs must not contain passwords, tokens, session ids or full request bodies. Error responses must not return stack traces, SQL or file paths. Look at what the 500 above would have shown the client in production, and confirm the error handler returns a generic message plus the request id (see observability across layers).
9. Admin and recovery
List every admin route and debug endpoint and confirm each needs the highest level of access. Turn off verbose error pages and debug flags in production. Confirm that the backups from database hosting, backups and restores are private and that you have restored one. A security incident is often also a data-loss incident.
Make it repeatable
Put the checks that can be automated into CI: dependency audit, a test that an unauthenticated request to each protected route returns 401, a test that user B gets 404 or 403 for user A’s project. Write the manual items down as a short list in the repository and run it before each release. A review you ran once is out of date in a month.
What the video covers
Beau Carnes’ “How to Secure a Web App” is about eight minutes and is a year and a half old. By its title it is a short introduction to securing a web app, so expect a broad tour of common risks rather than a walkthrough of authorization on an API. I could not read a transcript, so I do not know which items it lists. The checklist above is my own and the findings come from running it. Embrace The Red’s longer fundamentals talk is linked for more depth, but it is six years old.
Where this fits
You have a tested, deployed, observable and reviewed app. The last lesson puts it all together: shipping a complete app, the capstone.
Check yourself
Taskboard's GET /api/projects/1/tasks returned data with no sign-in. What class of bug is that?
Missing authentication and authorization. Any caller who guesses a project id can read it, so the route must check the session and that the user is a member of the project.
Why did a request to /api/projects/1%20or%201=1/tasks return a 500 even though it was not an injection?
Number() turned the string into NaN and passed it to the query as a parameter, so Postgres rejected it. The query was safe because it was parameterised, but the route never validated its input.
What stopped the DROP TABLE string stored in a task title from running?
The query used bound parameters, so the string was sent as data and stored literally as the title instead of being parsed as SQL.
Why test with two accounts?
Authorization bugs only show when one user asks for another user's objects, and a single account never triggers that.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.