Skip to content
mentoor

Security flaws in generated code

For engineers

The vulnerability classes AI assistants write most often: injection, missing authorization, leaked secrets, trusted input and unsafe defaults

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

An AI assistant builds a query with an f-string that includes a request parameter. What is the correct fix?

Choose one answer

Check yourself · 2 of 5

A generated endpoint has a login middleware and returns an invoice by id from the URL. What is still missing?

Choose one answer

Check yourself · 3 of 5

An AI-written feature fetches any URL the user types and returns the page text. Which attack does this allow?

Choose one answer

Check yourself · 4 of 5

An AI agent committed an API key, and you removed it in the next commit. What else is required?

Choose one answer

Check yourself · 5 of 5

A browser blocks a call from https://app.example.com to your API. Which CORS setting is the right fix?

Choose one answer

Topics

  1. Injection in AI-written queries and commands4 min read · SQL, shell, template and path injection from string-built queries and commands that models still produce
  2. Missing authorization and broken access control4 min read · Endpoints that check login but not ownership, insecure direct object references and admin routes without role checks
  3. Trusting input: SSRF, uploads and deserialization4 min read · User-controlled URLs, files and payloads that generated code fetches, stores or parses without validation
  4. Hardcoded secrets and credential leaks4 min read · Keys in code, config, test fixtures, logs and agent transcripts, and how secret scanning and rotation fix them
  5. Unsafe defaults: CORS, debug mode and crypto4 min read · Wildcard CORS, debug flags, disabled TLS verification, weak hashing and broad permissions that make demos work
  6. Asking coding agents for secure code4 min read · Security requirements in the task, a threat-focused second review pass, and why 'make it secure' is not enough

Start here

110 questions · last verified 2026-12