Skip to main content
Module 11 · Lesson 2 of 338/42 in the course~20 min
Module lessons (2/3)

Subresource Integrity (SRI) & Digest Checks

Lesson preview6 hands-on exercises readyApplication & Web Security · Module 11 — Software Supply Chain & CI/CD Hardening

Compute W3C sha256 Base64 integrity hashes with Web Crypto and block tampered external artifacts before execution.

What you'll learn in this lesson

  • Demonstrate how an upstream CDN compromise injects rogue JavaScript when third-party bundles lack cryptographic integrity pinning.
  • Compute cryptographic W3C Subresource Integrity (SRI) sha256-... digests in the browser using crypto.subtle.digest.
  • Enforce strict <script> tag policies (crossorigin="anonymous", immutable version URLs) and lockfile registry/integrity validation.

Overview

Modern frontends and build scripts download dependencies from CDNs (cdn.example/widget.js) or public package registries. If an attacker hijacks the CDN origin or swaps an unpinned @latest package, your users run attacker JavaScript inside your site's origin with full access to DOM, tokens, and session state — unless the runtime checks Subresource…

<script src="https://cdn.example/v2.1.0/widget.js" integrity="sha256-..." crossorigin="anonymous"></script>

Sections covered in this lesson

  1. 11. SRI Digests, CORS Constraints & Lockfile Verification
  2. 22. Interactive Explorer: SRI Hash & Lockfile Integrity Inspector
  3. 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
  4. 44. Checkpoints & Code Review
Pro Lesson · Module 11 — Software Supply Chain & CI/CD Hardening

Unlock "Subresource Integrity (SRI) & Digest Checks" and the full Application & Web Security curriculum

Compute W3C sha256 Base64 integrity hashes with Web Crypto and block tampered external artifacts before execution.

Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Application & Web Security plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.