SecureSeniorSecurityAuto-graded
Stop a URL fetcher from reaching internal addresses
Make is_safe_url reject loopback, private and cloud metadata addresses, encoded IPs included, with no DNS lookups.Users give the app a URL and the server fetches it, for link previews, webhook test pings and avatar imports. Every fetch goes throughis_safe_url(url) first. In a security review it let through 169.254.169.254, 10.0.0.5, 0x7f000001 and most other SSRF payloads. Make it return True for public http(s) URLs and False for everything else, decide offline with no DNS lookups or sockets, and keep assert_safe raising SSRFError on anything unsafe.35 min
python
You're done when
- URLs that point to a private, loopback or link-local address are refused, including the cloud metadata endpoint.
- Malformed or garbage input returns
Falseinstead of raising. assert_saferaisesSSRFErrorwhen the URL is not safe.
What it measures
Application securitySeeing that a fetch made by your server can reach internal addresses your users can't.
Security control testing and evaluationWhether every reserved range and non-http scheme is blocked, beyond the few addresses the review named.
Correct primitivesWhether the check still holds when an address is written in an unusual notation.
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
35 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