Skip to content

Course

Secure Frontend Engineering

Every client-side trust boundary — DOM sinks, sanitizers, Trusted Types, CSP, the script supply chain, and cross-window messaging — explained by mechanism and hardened into concrete practice.

14 lessons

Course Q&A

Keep reading

Related articles from the SudoSecurity blog.

Reviews

Enrolled members can rate this course.

No reviews yet.

XSS: How Strings Become Code

Every DOM sink that parses attacker input, the three delivery paths, framework escape hatches, and DOM clobbering.

  1. 01The Sinks That ExecuteinnerHTML, document.write, eval, javascript: URLs, srcdoc, and setAttribute handlers — every API that turns a string into live code, and the grep list for auditing them.14mOpen
  2. 02Reflected, Stored, and DOM-Based XSSHow the payload arrives defines the bug class: reflected rides the request, stored waits in the database for admins, and DOM XSS never crosses your perimeter at all.15mOpen
  3. 03Framework Escape HatchesReact's dangerouslySetInnerHTML and unfiltered href schemes, Vue v-html, Angular's bypassSecurityTrust* calls, and jQuery's script-executing parseHTML.13mOpen
  4. 04DOM ClobberingInjected id and name attributes shadow globals your JS reads — how AMP4Email in Gmail fell to markup that contained no script at all.12mOpen

Sanitization and Trusted Types

Why sanitizers must parse rather than pattern-match, mutation XSS, and Trusted Types enforcement at the sink.

  1. 01Sanitizers and Mutation XSSSanitization is a parse-transform-serialize pipeline, and mutation XSS lives in the gap between your sanitizer's parse and the browser's re-parse.13mOpen
  2. 02Trusted Typesrequire-trusted-types-for 'script' makes every DOM sink reject plain strings; policies mint TrustedHTML through DOMPurify, and the 'default' policy quietly undoes enforcement.13mOpen

Content Security Policy

Building a deny-by-default CSP with nonces and strict-dynamic, deploying it via report-only, and the bypasses that still work.

  1. 01A CSP That Actually Blocks ThingsThe deny-by-default policy with nonces, strict-dynamic, base-uri, and form-action — and why script-src 'self' 'unsafe-inline' protects nothing.14mOpen
  2. 02Nonces, Hashes, and strict-dynamicPer-response nonce plumbing through middleware, why strict-dynamic makes host allowlists optional, and report-driven rollout.13mOpen
  3. 03CSP Bypasses and What It Can't StopJSONP endpoints and script gadgets on allowed hosts, path collapse on redirects, missing base-uri and form-action directives, and the attacks CSP never governed.13mOpen

The Client-Side Supply Chain

Third-party script privileges, Subresource Integrity pinning, and npm lifecycle scripts and lockfile integrity.

  1. 01Third-Party Scripts Are Remote CodeA script tag hands your origin to a remote operator — polyfill.io's 2024 sale and the Magecart skimming of British Airways as the evidence.12mOpen
  2. 02Subresource IntegrityThe integrity attribute pins the bytes a fetched file must match — how to generate hashes, the CORS requirement, and why mutable endpoints can't be pinned.11mOpen
  3. 03npm and the Lockfilenpm install executes lifecycle scripts before your app builds; the lockfile pins resolved URLs and sha512 hashes — event-stream, Ledger Connect Kit, and dependency confusion as the threat model.13mOpen

Boundaries Between Windows

postMessage origin and source validation, iframe sandbox tokens, clickjacking defenses, and COOP/COEP isolation.

  1. 01postMessage BoundariesSender-side targetOrigin, receiver-side exact origin matching, why substring checks fail, and event.data as an untrusted source feeding DOM sinks.12mOpen
  2. 02iframes, sandbox, and ClickjackingThe sandbox attribute's capability tokens, the allow-same-origin plus allow-scripts escape, frame-ancestors as the real anti-framing control, and COOP/COEP isolation.13mOpen