From 67d04da5aa96b09067cf251f9d9e5268b67975ff Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 4 Jul 2026 14:05:02 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20CSP=20Trust?= =?UTF-8?q?ed=20Types=20=EC=A0=95=EC=B1=85=20=EB=84=A4=EC=9D=B4=ED=8B=B0?= =?UTF-8?q?=EB=B8=8C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit index.html의 Content-Security-Policy에 `require-trusted-types-for 'script'` 지시어를 추가하여 브라우저에서 DOM XSS 공격의 주요 경로가 되는 unsafe sink들을 기본적으로 차단합니다. 애플리케이션이 `innerHTML`과 같은 위험한 API를 사용하지 않고 안전한 `textContent` API를 사용하므로, 별도의 Trusted Types 정책 정의나 외부 DOMPurify 라이브러리 없이도 안정적으로 도입이 가능합니다. 이로써 외부 스크립트 등에 의한 잠재적인 DOM 기반 공격을 원천적으로 막는 zero-dependency Defense-in-depth 계층을 구축했습니다. --- .jules/sentinel.md | 4 ++++ index.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.jules/sentinel.md b/.jules/sentinel.md index e30db0d..cc697fd 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -14,3 +14,7 @@ **Vulnerability:** 외부 링크(특히 참조문헌 링크 등)에 `target="_blank"` 속성을 사용하거나 새 탭으로 여는 동작을 유도할 때, `rel="noopener noreferrer"` 속성이 누락되어 Reverse Tabnabbing 공격에 노출될 수 있음. **Learning:** `rel="noopener noreferrer"`가 없으면 새로 열린 탭의 페이지가 `window.opener` 객체를 통해 원래 페이지의 `location`을 악의적인 사이트로 변경할 수 있습니다. **Prevention:** 외부 링크를 새 탭으로 열기 위해 `target="_blank"`를 사용할 때만 `rel="noopener noreferrer"`를 함께 추가하여 부모 창에 대한 접근을 차단해야 합니다. +## 2026-07-04 - Enforce Trusted Types natively +**Vulnerability:** The application was not enforcing Trusted Types in its Content Security Policy, leaving it theoretically vulnerable to DOM XSS if unsafe DOM sinks (like innerHTML) were ever introduced in the future. +**Learning:** When an application exclusively uses safe DOM APIs (like `textContent`) and lacks risky sinks, `require-trusted-types-for 'script'` can be enforced natively via CSP without needing to define a Trusted Types policy or use external sanitizers like DOMPurify. This provides a zero-dependency defense-in-depth layer against future regressions. +**Prevention:** For static sites using safe DOM manipulation, always add `require-trusted-types-for 'script'` to the CSP to proactively block any future usage of unsafe DOM sinks. diff --git a/index.html b/index.html index d188886..063ebea 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@
- +