Content Security Policy
콘텐츠 보안 정책
콘텐츠 보안 정책(CSP)은 브라우저 콘텐츠를 위한 HTTP 규칙입니다. 어떤 파일이 로드될 수 있고 어떤 스크립트가 실행될 수 있는지를 제한합니다.
다른 예시
은행 SPA는 `Content-Security-Policy-Report-Only`로 시작하고 인라인 핸들러를 제거합니다. 그 다음 `script-src 'nonce-r4…' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`를 적용합니다. 모든 응답에는 새롭고 추측하기 어려운 nonce가 부여됩니다. 샘플링된 위반 보고서에는 고객 URL이 기록되지 않습니다.
주요 부분
- 01정책 전달
- 02디렉티브 가져오기 및 문서화
- 03위반 보고 및 배포
사용할 때
추가 방어 수단으로 테스트된 엄격한 CSP를 사용하세요. 가능하면 nonce 또는 해시를 사용하세요. 변경된 정책을 완전히 적용하기 전에 보고서를 확인하세요.
다음 경우에는 사용하지 마세요
넓은 `*` 또는 `unsafe-inline` 규칙을 강한 보안처럼 다루거나 추측 가능한 nonce를 재사용하지 마세요. CSP는 일반 XSS 방지를 대체하지 못합니다.
코드에서 사용된 이름
Content-Security-Policy response header with nonces/hashes and restrictive directives 출시하기 전에
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome:Complete the task with 콘텐츠 보안 정책 (Content Security Policy)。 User context:은행 SPA는 `Content-Security-Policy-Report-Only`로 시작하고 인라인 핸들러를 제거합니다. 그 다음 `script-src 'nonce-r4…' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`를 적용합니다. 모든 응답에는 새롭고 추측하기 어려운 nonce가 부여됩니다. 샘플링된 위반 보고서에는 고객 URL이 기록되지 않습니다. Technical concept or control:콘텐츠 보안 정책 (Content Security Policy)。 Why it fits:추가 방어 수단으로 테스트된 엄격한 CSP를 사용하세요. 가능하면 nonce 또는 해시를 사용하세요. 변경된 정책을 완전히 적용하기 전에 보고서를 확인하세요. Do not use it when:넓은 `*` 또는 `unsafe-inline` 규칙을 강한 보안처럼 다루거나 추측 가능한 nonce를 재사용하지 마세요. CSP는 일반 XSS 방지를 대체하지 못합니다. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary):공식 문서라고 해도 초안, 출시 후보, 최종 버전일 수 있어요. 상태와 브라우저나 플랫폼 지원 여부를 꼭 확인하세요. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
이 요청을 확인하세요
Review how 콘텐츠 보안 정책 (Content Security Policy) is used now. Definition: 콘텐츠 보안 정책(CSP)은 브라우저 콘텐츠를 위한 HTTP 규칙입니다. 어떤 파일이 로드될 수 있고 어떤 스크립트가 실행될 수 있는지를 제한합니다. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.