Lion Cipher Lab

Stop a third-party script skimmer with Subresource Integrity

Why it matters

Almost every real website loads JavaScript from somebody else's server -- analytics, chat widgets, payment helpers, ad tags, font loaders. Each of those <script src> lines is a permanent, unlimited grant: that vendor's code runs inside YOUR page, with full access to your DOM, your forms, your cookies and your users' keystrokes, and it is re-downloaded fresh on every page load, so whatever the vendor ships tomorrow runs on your checkout tomorrow. That is exactly how the Magecart family of card-skimming breaches worked: the attackers compromised a script provider rather than the victim…

What you'll learn

Steps in this lab

  1. The grant you make every time you write <script src=>
  2. Build the shop and the CDN as two separate local origins
  3. Serve both origins and confirm the third-party script works
  4. Put on the attacker hat: compromise the CDN, not the shop
  5. Watch the card leave, in the Network tab
  6. Generate the digest: what a sha384- string actually is
  7. Pin it -- and hit the CORS wall that teaches you what SRI needs
  8. Re-run the attack and watch the browser refuse it
  9. Layer a CSP allowlist -- as a supply-chain control, not an XSS fix
  10. What SRI does NOT solve -- five honest gaps
  11. The pro move: self-host first, pin second, and the compliance hook

Open the full interactive lab →