Skip to content
Skillpedia
Security75k · #3041

subresource-integrity

What it does

This skill checks the external scripts and styles on a web page and adds integrity hashes to them. It is for developers who load code from outside their own servers.

When to use it

  • ✓When a page loads JavaScript or CSS from a CDN without an integrity attribute.
  • ✓When reviewing HTML templates that include external script or link tags.
  • ✓When someone asks how to protect visitors if a CDN is compromised.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/subresource-integrity/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/subresource-integrity/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My site loads scripts from a CDN. How do I make sure nobody can swap them for malicious code?”

5 new skills a week. 1 minute to read.

How it works

The agent finds external files that have no fingerprint and adds one. Browsers then compare each downloaded file with its fingerprint and block any file that does not match.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Add Subresource Integrity to external scripts

When you load JavaScript from a CDN, you're trusting that CDN completely — if it's compromised, attackers can serve malicious JavaScript to all your users. SRI adds a cryptographic hash to the tag; the browser refuses to execute the script if the hash doesn't match the downloaded content, protecting users even if the CDN is compromised or the URL is hijacked.

Quick Reference

  • Add integrity="sha384-..." to <script> and <link> tags loading from CDNs
  • Always pair integrity with crossorigin="anonymous"
  • Generate hashes with openssl or online tools — CDN providers usually supply them
  • SRI blocks execution if the file hash doesn't match, preventing CDN compromise attacks

Check

Find all external <script> and <link rel=stylesheet> tags in this HTML that load from CDNs and don't have integrity attributes. List each one.

Fix

Add appropriate integrity and crossorigin attributes to external CDN resources. Generate the SHA-384 hashes for each resource.

Explain

Explain Subresource Integrity, how it protects against CDN compromise, how to generate SRI hashes, and its limitations.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Add Subresource Integrity to external scripts. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/html/subresource-integrity

FAQ

What is a subresource integrity hash?

It is a short code that describes the exact contents of a file. The browser compares it with the downloaded file before running it.

Do I need this for files my own server hosts?

The skill focuses on external CDN files. Files your site hosts itself are not the main target here.

Does the skill mention the limits of this method?

Yes. It also explains the limitations, so you know what the check does and does not protect against.

Details

Original description by the author

Use when reviewing templates, rendered HTML, or shared components related to Add Subresource Integrity to external scripts. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#3041
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills