SecureMidSecurityAuto-graded
Fix a login where user input becomes SQL
A pentest found inputs that bypass the login and list every user; close both holes without changing normal behaviour.auth.py holds the queries behind a login form and a user-directory search box, running against a real sqlite database. A pentest found that a crafted username logs in as someone else without a password, and a crafted search term returns every user in the table. Fix both so crafted input gets nowhere. Normal logins and searches must work exactly as before, and names with apostrophes, like O'Brien, are normal input.25 min
python, sqlite
You're done when
- Login succeeds for correct credentials and fails for incorrect ones.
- Search returns the right users for ordinary queries.
- Crafted input can no longer log in without the right password.
- Crafted search input no longer returns users it shouldn't.
What it measures
Injection defenceClosing the hole for any crafted input, beyond the two payloads in the report.
Query behaviourMaking sure normal input returns exactly the same rows as before.
VerificationConfirming the attacks fail and normal use still works.
Your environment
Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish
Start this lab
25 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo