Security··1 min read

A practical security checklist for small web apps

You don't need a security team to avoid the most common mistakes. This is the short list I go through before anything goes live.

Updated

Small projects get attacked too, usually by automated scripts looking for easy wins. The good news: a short checklist removes most of the easy wins.

Authentication

  • Hash passwords with a slow algorithm (bcrypt or argon2).
  • Require two-factor authentication for admin accounts.
  • Rate-limit login attempts and lock accounts after repeated failures.
  • Use HttpOnly, Secure and SameSite cookies.

Input and output

Never trust input. Validate everything on the server, even if the browser already did:

const schema = z.object({
  email: z.email(),
  message: z.string().min(10).max(5000),
});

And escape or sanitize anything you render, especially user-generated Markdown or HTML.

Headers

A strict Content-Security-Policy, X-Content-Type-Options: nosniff and frame-ancestors 'none' block whole classes of attacks for almost no effort.

Secrets and infrastructure

  1. Keep secrets in environment variables, never in the repository.
  2. Don't expose your database to the internet.
  3. Run containers as a non-root user.
  4. Keep dependencies updated.

Backups

Security also means recovering from mistakes. Automate backups and test a restore at least once.

None of this is glamorous, but it's the difference between a quiet week and a very bad one.

ShareXLinkedInEmail
Youness A.L

Written by Youness A.L

Software engineer

I build useful, secure, well-made software: web platforms, mobile apps and tools that automate the boring parts of a business. If you have a project in mind, I'd love to hear about it.

Get new posts by email

Notes on building useful, secure software and the work behind it. No spam, unsubscribe anytime.

New tools are exciting. Proven tools ship. Here's how I pick a stack when the goal is a product people can rely on.

·1 min read

Most small businesses don't need an AI strategy. They need the three repetitive tasks that eat their week to disappear.

·1 min read