Lion Cipher Lab

Block cross-site attacks with a Fetch Metadata resource isolation policy (Sec-Fetch-* headers)

Why it matters

Several of the web's nastiest bug classes share one shape: some other website makes YOUR browser send a request to a site you are logged into, and the browser helpfully attaches your cookies. A hidden form forges a money transfer (CSRF). A script tag pulls in a JavaScript file that contains your API key (XSSI, cross-site script inclusion). An invisible image or a timed request tells the other site whether you are logged in, or what is in your account (XS-Leaks, cross-site leaks). Each has its own classic fix, and teams forget one. Modern browsers now label every request with Fetch Metadata…

What you'll learn

Steps in this lab

  1. The problem in one breath: other websites can make your browser send requests
  2. Meet the four Sec-Fetch-* headers
  3. Set up a folder and check Python
  4. Build the toy bank, with the policy already inside it
  5. Build the request-matrix harness (and be honest about what it simulates)
  6. BEFORE: run it with no policy
  7. Report-only first: see what you would block before you block it
  8. The tempting one-liner, measured: 'just block cross-site'
  9. AFTER: the baseline policy, and the four attacks it lets through
  10. Same-site is not same-origin: decide per endpoint how far to trust your siblings
  11. Hardened: three more rules, measured, and the one attack left standing
  12. Tell caches the answer depends on the headers (Vary)
  13. When it does NOT protect you, and what to pair it with
  14. Optional: see the real headers in your own browser (DevTools)
  15. What you measured, and the reflex to keep

Open the full interactive lab →