Skip to main content
Wright Websites

sri-sentinel

check subresource integrity

Find missing, wrong or stale integrity attributes on scripts and styles in a built site.

  • 20/week on npm
  • 2★
  • MIT
  • v1.1.3
  • In use on this site
  • Security & Headers
npx sri-sentinel

Read the full README on GitHub (opens in a new tab)View on npm (opens in a new tab)

sri-sentinel

From the README

sri-sentinel scans the HTML in a built site directory for , , rel="modulepreload", rel="preload" as="script|style", and *integrity entries inside . It hashes the local files (and, with --remote, CDN files), then either writes integrity attributes (plus crossorigin="anonymous" for cross-origin resources) or checks** that the existing ones are correct. Every finding includes a file, line number, severity and a concrete fix.

npx sri-sentinel dist --write              # add integrity attributes to dist/**/*.html
npx sri-sentinel dist --check              # CI: fail on missing, wrong or stale integrity
npx sri-sentinel dist --write --remote     # also fetch and hash CDN resources
npx sri-sentinel dist --manifest sri.json  # JSON manifest of resource -> integrity

Where we use it

CI job on this site: html · audit:sri · In use

Related service: Web hosting

Related packages

Security & Headers