본문으로 건너뛰기
Skillpedia
보안75k · #3041

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.

repo: thedaviddias/Front-End-Checklist

인기도

GitHub 스타
75k
순위
#3041
라이선스
MIT
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬