subresource-integrity
하는 일
이 스킬은 웹 페이지의 외부 스크립트와 스타일을 확인하고 무결성 해시를 추가합니다. 자체 서버 밖에서 코드를 불러오는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓integrity 속성 없이 CDN에서 JavaScript나 CSS를 불러오는 페이지가 있을 때.
- ✓외부 스크립트나 link 태그가 포함된 HTML 템플릿을 검토할 때.
- ✓CDN이 해킹되었을 때 방문자를 어떻게 보호할지 묻는 경우.
스킬 링크
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/subresource-integrity/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 사이트는 CDN에서 스크립트를 불러옵니다. 누군가 악성 코드로 바꾸지 못하게 하려면 어떻게 해야 하나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 지문이 없는 외부 파일을 찾아 지문을 추가합니다. 그러면 브라우저는 내려받은 파일을 지문과 비교하고, 일치하지 않는 파일은 실행하지 않습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
무결성 해시란 무엇인가요?
파일의 정확한 내용을 나타내는 짧은 코드입니다. 브라우저는 파일을 실행하기 전에 이 값과 내려받은 파일을 비교합니다.
사이트 자체 서버에 있는 파일에도 필요한가요?
이 스킬은 주로 외부 CDN 파일을 다룹니다. 사이트가 직접 호스팅하는 파일은 주된 대상이 아닙니다.
이 방법의 한계도 설명하나요?
네. 이 스킬은 한계도 함께 설명하므로, 이 검사가 무엇을 막고 무엇을 막지 못하는지 알 수 있습니다.
상세 정보
작성자의 원본 설명
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.
인기도
- GitHub 스타
- 75k
- 순위
- #3041
- 라이선스
- MIT
- 업데이트
- 2026. 10. 31.
댓글
- …
이 저장소의 다른 스킬
frontendchecklist
75k명령줄 도구를 사용해 380개가 넘는 규칙으로 프런트엔드 코드와 실시간 페이지를 접근성, 속도, SEO, 보안 측면에서 점검합니다.
frontend-checklist-global
75kFront-End Checklist의 386개 규칙 전체로 프런트엔드 프로젝트를 감사하고, 발견한 문제마다 구체적인 해결 방법을 제시합니다.
404-page
75k없는 페이지 화면에 도움이 되는 링크가 있고 실제 404 상태 코드를 반환하는지 확인해, 길을 잃은 방문자를 돕습니다.
about-page
75k사이트를 운영하는 사람을 설명하는 명확한 소개 페이지가 있는지 검토해, 방문자와 검색 엔진의 신뢰를 높입니다.