Web app security for builders
The habits that stop the most common web bugs
A builder's tour of the OWASP Top 10:2025: safe queries, server-side access checks, sessions, input and output handling, security headers, dependencies, logging and a review checklist.
beginner level, 14 minutes, 19 slides.
Web app security for builders
Welcome. A builder's tour of the OWASP Top 10:2025: safe queries, server-side access checks, sessions, input and output handling, security headers, dependencies, logging and a review checklist. This talk runs about 14 minutes.
Build it safe from the first line
The OWASP Top 10 is a standard awareness document for developers and web application security. It reflects a broad consensus about the most critical security risks to web applications.
Most web security problems are not exotic. They come from a small set of habits that builders either have or do not have. OWASP publishes the Top 10, a standard awareness document for developers. It represents a broad consensus about the most critical security risks to web applications. In this talk we use the current 2025 edition as a map, and for each risk we look at the practical habit that prevents it. You do not need to be a security expert to start.
The OWASP Top 10:2025
A01 to A05
- A01 Broken Access Control (covered)
- A02 Security Misconfiguration (headers)
- A03 Software Supply Chain Failures (covered)
- A04 Cryptographic Failures
- A05 Injection (covered)
A06 to A10
- A06 Insecure Design
- A07 Authentication Failures (covered)
- A08 Software or Data Integrity Failures
- A09 Security Logging and Alerting Failures (covered)
- A10 Mishandling of Exceptional Conditions (covered)
Define: risk category: Each entry is a group of related weaknesses, not one single bug.
Here is the 2025 list. A01 is Broken Access Control, then Security Misconfiguration, Software Supply Chain Failures, Cryptographic Failures, Injection, Insecure Design, Authentication Failures, Software or Data Integrity Failures, Security Logging and Alerting Failures, and Mishandling of Exceptional Conditions. Each entry is a family of related weaknesses, not one single bug. We will cover seven of the ten, and we also look at security headers, which help with misconfiguration. Rankings change between editions, so always check the current list.
Injection: data treated as commands
Definition from OWASP: An injection flaw lets untrusted user input be sent to an interpreter, such as a browser, a database or the command line, which then runs parts of that input as commands.
Risky
- Joining user text into a query string
- Dynamic queries without safe handling
- Trusting that input looks harmless
Safer
- Keep data separate from commands
- Use a safe API or parameterized interface
- Validate on the server as extra help
- OWASP says the best way to prevent injection is keeping data separate from commands and queries.
Injection happens when an application sends untrusted input to an interpreter, which could be a database, the command line, or a browser, and the interpreter runs part of that input as commands. SQL injection is the famous example, but the idea is the same for every interpreter. OWASP says the best means of prevention is keeping data separate from commands and queries. In other words, the program should always know which part is the instruction and which part is just information supplied by a user.
Parameterised queries
From the OWASP Query Parameterization Cheat Sheet. The ? is a placeholder.
String custname = request.getParameter("customerName");
String query = "SELECT account_balance FROM user_data WHERE user_name = ?";
PreparedStatement pstmt = connection.prepareStatement(query);
pstmt.setString(1, custname);
ResultSet results = pstmt.executeQuery();- The query text is fixed. The user's value is passed separately.
- Do the parameterization on the server, not only in client-side libraries.
- Stored procedures are not magic: building queries by joining strings inside them is still unsafe.
Try it: Prevent SQL injection with parameterized queries (hands-on)
This is what safe looks like. The query text has a question mark placeholder, and the user's value is supplied in a separate step. The database never mixes the two, so the value cannot change the meaning of the query. OWASP's cheat sheet warns that many client-side libraries only join strings before sending, so make sure parameterization happens server-side. OWASP also notes that stored procedures can still be unsafe if they join query text and data inside them. Most languages and frameworks have a built-in way to do this.
Broken access control
Access control makes sure users cannot act outside their intended permissions. OWASP ranks failures A01 and says 100% of applications tested had some form of it.
- Access that should be limited is open to anyone.
- Viewing or editing someone else's account by changing an identifier in the request.
- An API with missing checks on POST, PUT and DELETE.
- Guessing URLs to reach pages the user should not see.
Define: IDOR: An insecure direct object reference is when a user can reach another user's record just by supplying its identifier.
Access control is the rule that says who is allowed to do what. When it fails, people see or change things that are not theirs. OWASP keeps this category at number one, and says that one hundred percent of the applications it tested had some form of broken access control. Common patterns include access open to anyone, changing an identifier in a request to view someone else's account, APIs missing checks on write operations, and guessing URLs to reach hidden pages. The usual cause is not clever attacks. It is a missing check.
Check on the server, every request
No check passed, no data. Deny by default.
- Request: Arrives from any client
- Who is this?: Session or token
- Allowed?: Role and ownership
- Data: Only if allowed
A server-side ownership check, simplified.
const note = await db.getNote(noteId);
if (!note || note.ownerId !== session.userId) {
return respond(403); // deny by default
}
return respond(200, note);- OWASP: access control works only in trusted server-side code, where the attacker cannot change the check.
- Validate permissions on every request, and never rely on client-side checks.
The fix has a clear shape. Every request goes through the same questions on the server: who is this, and are they allowed to do this to this specific record? OWASP says access control is only effective in trusted server-side code, and the Authorization Cheat Sheet says to validate permissions on every request and never rely on client-side checks, because client-side logic is easy to bypass. Deny by default means that if no rule grants access, access is refused. Notice the code checks ownership of the record, not just that the user is logged in.
Authentication basics
Authentication is proving who you are. OWASP calls the failures A07.
| Weakness OWASP lists | Builder habit |
|---|---|
| Automated attacks such as credential stuffing and brute force are not blocked | Limit or delay failed attempts, log them and alert; offer multi-factor authentication |
| Default, weak or well-known passwords | Ship with no default credentials; check new passwords against lists of weak or breached ones |
| Different messages reveal which accounts exist | Use the same message for every outcome, such as: Invalid username or password. |
| Passwords stored as plain text or weakly hashed | Use strong password hashing (see A04, Cryptographic Failures) |
Careful with lockouts: OWASP warns that limiting failed logins must not create a denial of service. Delay increasingly rather than locking everyone out.
Authentication means proving who you are. OWASP's A07 category lists common weaknesses. Credential stuffing is when attackers try leaked username and password pairs from other breaches. Defenses include multi-factor authentication, limiting or increasingly delaying failed attempts, shipping with no default credentials, and checking new passwords against lists of breached or weak ones. Use the same message for every failed login, so the page does not reveal which accounts exist. And be careful with lockouts: OWASP warns not to create a denial of service by locking out real users.
Session basics
A session is how the server remembers you between requests, usually through a cookie holding a session ID.
Cookie example from the OWASP Session Management Cheat Sheet.
Set-Cookie: __Host-SessionID=<value>; Secure; HttpOnly; SameSite=Strict; Path=/| Attribute | What it does |
|---|---|
| Secure | Browser sends the cookie only over HTTPS |
| HttpOnly | Page scripts cannot read the cookie |
| SameSite | Controls whether the cookie goes with cross-site requests |
- Use your framework's session ID. Renew it after login or any privilege change.
- OWASP does not recommend storing session IDs or tokens in localStorage or sessionStorage.
Sessions let a server remember who you are. The usual way is a cookie holding a session ID, so that ID must be protected like a password. Here is OWASP's example cookie. Secure means the browser only sends it over HTTPS. HttpOnly means scripts on the page cannot read it. SameSite controls whether it goes along with cross-site requests. OWASP recommends using the session ID your framework creates, and renewing it after login or any privilege change. It also says not to store session IDs or tokens in localStorage or sessionStorage.
Validate input with allowlists
Input validation checks whether data meets your application's requirements before you use it.
| Input | Rule to enforce |
|---|---|
| Fixed choices | Exact membership in the allowed set, even for drop-down values |
| Numbers and dates | Expected type, format, and minimum and maximum |
| Strings | Length limits and the characters or structure the field needs |
| Arrays | Minimum and maximum item counts, every item checked |
Allowlist, not denylist: Define what you accept and reject the rest. Blocking apostrophes, for example, rejects legitimate names without making a database query safe.
Validation means checking data before you use it. The OWASP cheat sheet says to define rules for each field: for fixed choices, exact membership in the allowed set; for numbers and dates, type, format and range; for strings, length limits and the characters the field needs. The key idea is the allowlist. Define what you accept and reject everything else. A denylist tries to recognize bad strings and always misses some. OWASP gives a neat example: blocking apostrophes rejects legitimate names without making a query safe. Validation helps, but it is not a replacement for parameterized queries.
Encode output for where it lands
Input validation
- Runs when data comes in
- Checks it fits the field rules
- Does not replace output protection
Output encoding
- Runs when data goes out to a page
- Makes data display as text, not code
- Depends on the context: HTML, JavaScript, URL
- Define: cross-site scripting (XSS) is untrusted data running as code in someone's browser.
- OWASP: many frameworks escape every value by default. Start there.
- Using the wrong encoding for a context can introduce weaknesses.
Try it: Stop XSS with output encoding and a Content Security Policy
Validation protects the way in. Output encoding protects the way out. When you put user supplied data into a web page, encoding makes the browser show it as plain text instead of running it as code. That is the defense against cross-site scripting, often called XSS. OWASP says many frameworks escape every value they render by default, and it recommends that approach because it does not depend on deciding which data is untrusted. It also warns that different contexts, like HTML, JavaScript and URLs, need different encoding, and that validation does not replace these protections.
Security headers
Example response headers. A starting point, not a full policy.
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'self'
Referrer-Policy: no-referrer| Header | What MDN says it does |
|---|---|
| Strict-Transport-Security | Tells browsers to use only HTTPS for the host, and to upgrade future HTTP attempts |
| X-Content-Type-Options | The nosniff value tells browsers to respect the declared content type |
| Content-Security-Policy | Controls which resources a page may load, which helps guard against XSS |
| Referrer-Policy | Controls how much referrer information is sent with requests |
Test before you enforce: A strict policy can break a page. Try it on a copy of your site first.
Security headers are instructions your server sends to the browser with each response. Strict-Transport-Security tells the browser to use only HTTPS for your site. X-Content-Type-Options with nosniff says to respect the content type you declare. Content-Security-Policy controls which resources a page may load, and MDN says this helps guard against cross-site scripting. Referrer-Policy controls how much referrer information goes out with requests. These are a good safety net, but not a fix for the bugs underneath. Always test a strict policy on a copy of your site first.
Dependency risk
OWASP A03, Software Supply Chain Failures, covers breakdowns in building, distributing or updating software, often through weaknesses in third-party code and tools.
- Track the versions of everything you use, including nested (transitive) dependencies.
- Keep a software bill of materials (SBOM): a list of the components in your software.
- Remove unused dependencies and features.
- Watch sources such as CVE, NVD and OSV, and turn on security alerts for what you use.
- Tools OWASP names include Dependency-Track and Dependency-Check.
Your app is mostly other people's code. OWASP's A03 category, Software Supply Chain Failures, is about breakdowns in how software is built, distributed or updated, often through third-party code and tools. The advice is practical. Know exactly what you use, including dependencies of dependencies, which are called transitive dependencies. Keep a software bill of materials, which is simply a list of components. Remove what you do not need. Watch vulnerability sources like CVE, NVD and OSV, and use tools such as OWASP Dependency-Track or Dependency-Check to automate the watching.
Log it, and fail safely
Log on the server
- Logins and failed logins
- Access control failures
- Server-side validation failures
- Alert on suspicious behavior
Tell the user little
- Return a generic error response
- Keep details in server-side logs
- If a transaction errors, roll it back (fail closed)
Do not log everything: OWASP warns against logging sensitive information that should not be logged, such as personal or health data.
Two last habits. First, logging. OWASP A09 says that without logging and monitoring, attacks cannot be detected. Log logins and failed logins, access control failures and server-side validation failures, with enough context to spot suspicious accounts. Do not log sensitive data such as personal or health information. Second, errors. A10 says to handle problems where they happen. The Error Handling Cheat Sheet says to return a generic response to the user and keep the details in server-side logs. If a transaction fails halfway, roll the whole thing back. OWASP calls this failing closed.
A short secure code review checklist
| Area | Ask in review |
|---|---|
| Input | Is all input validated on the server, using allowlists and length limits? |
| Queries | Are values passed as parameters, not joined into SQL? |
| Output | Is output encoded for its context? |
| Access control | Is it enforced server-side, deny by default, with ownership checks? |
| Sessions | Are session cookies HttpOnly, Secure and SameSite? |
| Errors | Do error responses avoid sensitive details? |
Follow the data: OWASP suggests identifying sources (user input, uploads, API calls), sinks (queries, output, logs) and the boundaries between them.
When you review code, use a short checklist. The OWASP Secure Code Review Cheat Sheet groups its checks the same way we have used in this talk. For input, is validation on the server with allowlists and length limits? For queries, are values passed as parameters? For output, is it encoded for its context? For access control, is it enforced on the server, deny by default? For sessions, are the cookie attributes set? For errors, do responses avoid sensitive details? A good trick from OWASP is to follow the data from its sources to its sinks and check the boundary in between.
Check your understanding
Check yourself: What is the best way to stop a user's value from changing the meaning of a database query?
Answer: Use a parameterized query. Parameterized queries keep data separate from commands. Blocking characters is a denylist and OWASP notes it does not make a query safe.
Check yourself: Where must an access control check run to be effective?
Answer: In trusted server-side code. OWASP says access control is only effective in trusted server-side code, where the attacker cannot change the check.
Check yourself: Which pairing is correct?
Answer: Encoding protects data going out to a page, and validation checks data coming in. Input validation checks data on the way in. Output encoding makes data display as text on the way out. Headers are a safety net, not a replacement.
Three questions to check yourself. Pause the video and answer before you reveal each one. They cover parameterized queries, where access checks must run, and the difference between validating input and encoding output. If any answer surprises you, go back and look again at that slide. Short quizzes like this are a good way to turn a talk into a habit, and the labs after this will give you hands-on practice with the same ideas.
Recap
- Use the OWASP Top 10:2025 as your map.
- Keep data separate from commands: parameterize queries.
- Check access on the server, every request, deny by default.
- Protect sessions and handle logins carefully.
- Validate input, encode output.
- Add security headers, watch dependencies, log and fail safely.
To recap. The OWASP Top 10 for 2025 is your map. Keep data separate from commands by using parameterized queries. Check access on the server for every request and deny by default. Protect sessions and treat logins carefully. Validate input with allowlists and encode output for where it lands. Add security headers as a safety net, keep track of your dependencies, and log and fail safely. Next, try the labs to practice SQL injection defenses, output encoding, and secure defaults on a real app.
Practise this
- Understand SQL injection — and how to stop it
- Prevent SQL injection with parameterized queries (hands-on)
- Stop XSS with output encoding and a Content Security Policy
- Set secure defaults for a Node.js Express app with Helmet, header by header, measured
Slides only get you so far. Pick one of these hands-on labs and do it today while it is fresh. Every lab is free.
Sources
- OWASP Top 10:2025
- OWASP Top 10:2025, A05 Injection
- OWASP Query Parameterization Cheat Sheet
- OWASP Top 10:2025, A01 Broken Access Control
- OWASP Authorization Cheat Sheet
- OWASP Top 10:2025, A07 Authentication Failures
- OWASP Session Management Cheat Sheet
- OWASP Input Validation Cheat Sheet
- OWASP Cross Site Scripting Prevention Cheat Sheet
- MDN: Strict-Transport-Security header
- MDN: X-Content-Type-Options header
- MDN: Content-Security-Policy header
- MDN: Referrer-Policy header
- OWASP Top 10:2025, A03 Software Supply Chain Failures
- OWASP Top 10:2025, A09 Security Logging and Alerting Failures
- OWASP Top 10:2025, A10 Mishandling of Exceptional Conditions
- OWASP Error Handling Cheat Sheet
- OWASP Secure Code Review Cheat Sheet
Every claim in this deck came from these pages, fetched and checked for this release. Read the originals.
Hands-on labs for this deck
- Understand SQL injection — and how to stop it
- Prevent SQL injection with parameterized queries (hands-on)
- Stop XSS with output encoding and a Content Security Policy
- Set secure defaults for a Node.js Express app with Helmet, header by header, measured
Open the interactive deck or see all slide decks.
Related
- Understand SQL injection — and how to stop it
- Prevent SQL injection with parameterized queries (hands-on)
- Stop XSS with output encoding and a Content Security Policy
- Set secure defaults for a Node.js Express app with Helmet, header by header, measured
- All slide decks
- What is SQL injection?
- What is Defense in depth?
- Free cyber labs