The OWASP Top 10: A Developer's Guide to Web Security
The ten most common web vulnerabilities, what each looks like in real code, and how to close them.
In this guide
The OWASP Top 10 is the industry's list of the most dangerous web vulnerabilities. Knowing it is the difference between shipping and shipping safely. Here's each one, with the fix.
1. Broken access control
The most common vulnerability: a user can reach another user's data by changing an ID.
// BAD — trusts the client-supplied id
app.get("/invoice/:id", (req, res) => {
db.invoices.find(req.params.id).then(send); // any id works
});
// GOOD — scope to the authenticated user
app.get("/invoice/:id", auth, (req, res) => {
db.invoices.find({ id: req.params.id, owner: req.user.id }).then(send);
});2–4. Injection, broken auth, broken object refs
# BAD — string-built SQL (SQL injection)
q = f"SELECT * FROM users WHERE name = '{name}'"
# GOOD — parameterised query
cursor.execute("SELECT * FROM users WHERE name = %s", (name,))Use parameterised queries everywhere, hash passwords with a slow function (bcrypt/argon2), and never trust an object reference from the client.
5–7. Misconfig, XSS, insecure deserialisation
// BAD — renders user input as HTML (XSS)
<div>{userInput}</div>
// React escapes by default, but beware dangerouslySetInnerHTML
<div dangerouslySetInnerHTML={{ __html: userInput }} /> // audit thisThe checklist
- Authenticate and authorise on the server, never the client.
- Parameterise all queries; validate and escape all input.
- Use HTTPS everywhere; set security headers.
- Hash passwords; enforce MFA for privileged accounts.
- Keep dependencies patched — run a scanner.
- Log and monitor; know what normal looks like.
- Deny by default; least privilege for every role.
Security isn't a feature you add at the end. Every one of these is a design decision made in the first week of a project.
We test the systems we build the way an attacker would, then close the gaps. This list is where that starts — know it cold.
More from the lab
React vs Vue vs Svelte: Choosing a Frontend Framework
A candid, no-hype comparison of React, Vue and Svelte — where each shines, and what to pick.
LinuxThe Linux Command Line for Developers: 30 Commands
The terminal commands that make you dramatically faster — navigation, files, pipes, processes.
PythonRegular Expressions: A Developer's Guide
Regex demystified — anchors, classes, quantifiers, groups and lookaheads, with Python examples.
Want us to build this for you?
We turn tutorials like these into production systems every day. Tell us what you need.
Start a project →