Code of the Day
AdvancedSecurity Fundamentals

Lab: spot the vulnerability

Apply the security mindset — injection, password storage, and authorization.

Lab · optionalFundamentalsAdvanced10 min
Recommended first
By the end of this lesson you will be able to:
  • Recognise injection and its fix
  • Store passwords correctly
  • Tell authentication from authorization in a bug

Optional scenario lab. Security is a mindset — ask how each thing could be abused. Practice spotting the flaw and the fix.

Scenarios: thinking like an attacker

  1. 1.
    Code builds a query as: "SELECT * FROM users WHERE name = '" + name + "'". This is vulnerable to:
  2. 2.
    The right fix for that bug is to:
  3. 3.
    How should you store user passwords?
  4. 4.
    A logged-in user requests /orders/123, which belongs to someone else, and the app shows it. The missing check is:

The unifying habit: never trust input, keep data separate from code, and check both who you are and what you may do.

Finished reading? Mark it complete to track your progress.