Topic 1 of 5 · 4 min read
Using the OWASP Top 10 as a review map
Goal: Map the findings in a code sample to OWASP Top 10 (2025) categories and rank them by impact.
Use the OWASP Top 10 as a map, not a test: for each suspicious line in generated code, name its category, then rank the findings by what an attacker gains. The Top 10 is a list of the most common and costly web application risks, published by the Open Worldwide Application Security Project. The 2025 edition runs from A01 Broken Access Control to A10 Mishandling of Exceptional Conditions.
Check yourself · 1 of 3
A generated endpoint lets any logged-in user fetch any other user's invoice by changing the id in the URL. Which OWASP Top 10 (2025) category fits best?
Why it matters
An AI assistant such as Claude, ChatGPT, Copilot or Cursor writes code that works and looks tidy. It learned from public code, and public code is full of the same weaknesses. A review that says "this feels unsafe" gets argued about. A review that says "A01, any logged-in user can read any invoice" gets fixed.
The categories you meet most in generated code
- A01 Broken Access Control. A missing ownership check on an endpoint.
- A02 Security Misconfiguration. Debug mode on, wildcard CORS, default passwords.
- A03 Software Supply Chain Failures. An invented or typo-squatted package name, or an unpinned dependency.
- A04 Cryptographic Failures. MD5 for passwords, hard-coded keys, plain HTTP.
- A05 Injection. SQL built with string concatenation, shell commands built from input.
- A07 Authentication Failures. Weak sessions, no rate limit on login.
- A09 Security Logging and Alerting Failures and A10 Mishandling of Exceptional Conditions. Swallowed errors, secrets in logs, failing open.
How to review with it
- Read the diff and mark every line that touches input, identity, data access, secrets, config or a dependency.
- Give each mark a category. If none fits, it may not be a security finding.
- Rank: first what is reachable without logging in, then what exposes other users' data, then what needs unusual access.
- Write the finding as category, line, attacker gain, fix.
Before and after
Weak comment: "Be careful with this query."
Better: "A05 Injection, line 14: email is concatenated into the SQL string, so a request with ' OR 1=1 -- returns every user. Use a parameterised query."
What goes wrong
- Treating the list as complete. It names common risks, not every risk. Business-logic flaws still need thought.
- Ranking by category number. The numbers reflect the 2025 ranking of the category, not the severity of your finding. A reachable injection beats a theoretical misconfiguration.
- Stopping at the label. "A01" alone helps nobody. Say which line, which user, which data.
Examples
Labelling three findings in one handler
app.get('/invoices/:id', async (req, res) => {
const row = await db.query("SELECT * FROM invoices WHERE id = " + req.params.id);
res.json(row);
});
There is no login check (A01 Broken Access Control), the id is concatenated into SQL (A05 Injection) and nothing handles a failed query (A10). Rank: the injection first, since it exposes the whole database to anyone, then the missing access control, then the error handling.
Key points
- The OWASP Top 10 (2025) gives ten named categories, so a review comment can say exactly which kind of risk a line carries.
- Mark every line that touches input, identity, data access, secrets, config or dependencies, then label each mark with a category.
- Rank findings by attacker gain and reachability, not by the category number.
- A good finding states category, line, what an attacker gets and the fix.
- The Top 10 is a map of common risks, not a complete list: business-logic flaws need their own thought.
Common mistakes
- Treating the Top 10 as a complete checklist and ignoring flaws in the app's own business rules.
- Ordering findings by category number instead of by what an attacker can reach and take.
- Writing 'security issue' with no category, line or fix, which leaves the author nothing to act on.
Check yourself · 2 of 3
You find four problems in a pull request. Which should you flag first?
Check yourself · 3 of 3
Which review comment is most useful to the author of generated code?
Practice items, not counted towards your mastery.
Start here
- OWASP Top 10:2025 (opens in a new tab)StandardFree
The ten risk categories, from A01 Broken Access Control to A10 Mishandling of Exceptional Conditions, with examples and prevention advice.
- OWASP Cheat Sheet Series (opens in a new tab)DocsFree
Short, practical prevention guides for each topic in this skill.
- OWASP Application Security Verification Standard (opens in a new tab)StandardFree
A numbered list of security requirements you can cite in review comments.
More for this topic
- CWE Top 25 Most Dangerous Software Weaknesses (MITRE) (opens in a new tab)DocsFree
A ranked list of weakness types, useful for naming a finding precisely.