← All posts

Web app security basics every small product should have

The security foundations for a small web or mobile product: authentication, authorization on the server, input handling, secrets, dependencies, HTTPS, backups, logging and a plan for incidents.

Author
Elie Chaaban
Published
Reading time
5 min
Topics
Security, Web Apps, DevOps, Architecture

Small products are attacked for the same reasons large ones are: automated scanners do not care how big you are. They probe every public server for default passwords, exposed databases, known vulnerabilities in outdated software and login forms without limits. A small business app with customer data is a target simply because it is online.

You do not need a security team to be in good shape. You need a set of basics, done consistently. This post lists the foundations I put in place on every product I build and run, in plain terms, with the reasoning behind each.

1. Authentication done properly

Where possible, use a mature authentication library or service instead of writing your own. Authentication is full of subtle details.

2. Authorization on the server, for every request

The most common serious vulnerability in business apps is not exotic: a user changes an ID in a request and sees or edits someone else's data. The app hid the button, but the API never checked.

For products serving several companies, this extends to keeping each client's data separate. See multi-tenant or per-client deployments.

3. Treat all input as untrusted

If your product uses AI models, text that reaches the model is input too, and it can try to manipulate it. See prompt injection risks.

4. Secrets out of the code

API keys, database passwords and signing keys must never be committed to the repository or shipped inside a mobile app or web page.

5. HTTPS everywhere

Serve everything over HTTPS, redirect plain HTTP, and enable HSTS once you are confident. Modern reverse proxies obtain and renew certificates automatically, so there is no reason not to. Set secure cookie flags, so session cookies are never sent over plain connections or readable by scripts.

6. Security headers

A few HTTP headers block whole classes of attacks:

Start with a sensible baseline and tighten it as you learn which resources your site needs.

7. Dependencies and updates

Most applications are mostly other people's code: frameworks, libraries, base images. Vulnerabilities in them are published regularly.

8. Minimal exposure

9. Backups and recovery

Security includes being able to recover. Ransomware, a compromised account or a destructive bug can all destroy data. Keep automated, encrypted, off-site backups that the production server cannot delete, and test restoring them. See Postgres backups that actually restore.

10. Logging and monitoring

You cannot respond to what you cannot see:

See monitoring and alerts for a small product.

11. Personal data

Collect only what you need, keep it only as long as you need it, and know where it is. Data protection laws differ between Lebanon, the GCC countries, Europe and elsewhere, and some clients have their own requirements on where data is stored. If you serve users in several countries, take advice on the rules that apply, and design your data handling so it can meet them.

12. An incident plan

Write down, before you need it:

A one-page plan, read once by the team, is far better than improvising during an incident.

Mobile apps

Mobile apps add a few specifics:

Getting an outside view

For products handling sensitive data or payments, an external review or penetration test is worth it before launch or major releases. For an existing product, a technical audit covers security alongside the rest of the system. See what a technical audit should cover.

Summary

Most breaches of small products come from basic gaps: missing permission checks, exposed services, outdated software, leaked secrets and untested backups. Cover the basics above, keep them up to date, and you remove most of the risk.

If you want your product's security reviewed or built in from the start, read about me, see my work, and get in touch.

More from the blog

Let's work
together