Select
.krds-select · Figma Selection/Select 56:29
-From c175eba944c162667327340936b0dc472fc745a9 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 12 Jul 2026 13:52:25 +0000 Subject: [PATCH 1/4] fix(security): enforce strict CSP in component gallery --- .jules/sentinel.md | 4 ++ CHANGELOG.md | 1 + components/index.html | 46 +++------------ components/krds-gallery.css | 14 +++++ components/krds-gallery.js | 17 ++++++ tests/test_component_gallery_security.py | 75 ++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 37 deletions(-) create mode 100644 components/krds-gallery.css create mode 100644 components/krds-gallery.js create mode 100644 tests/test_component_gallery_security.py diff --git a/.jules/sentinel.md b/.jules/sentinel.md index 592251a..c7c7ffe 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -33,3 +33,7 @@ **Vulnerability:** DOM 기반 XSS (안전하지 않은 DOM 싱크 노출 위험) **Learning:** 이 앱은 주로 `textContent`와 같은 안전한 DOM API를 사용하고 `innerHTML` 등의 위험한 싱크를 피함. 이러한 환경에서는 브라우저 네이티브인 `require-trusted-types-for 'script'` CSP 규칙이 1차 방어선이며, 기본 Trusted Types 정책과 DOMPurify는 실제 HTML 싱크 또는 호환성 요구가 있을 때 방어적으로 로드해야 함. **Prevention:** 새로운 기능을 추가할 때 앱의 DOM API 사용 방식을 먼저 파악하고, 네이티브 Trusted Types CSP만으로 충분한지 또는 DOMPurify 기반 기본 정책이 필요한지 판단할 것. 기본 정책을 유지한다면 `window.trustedTypes`와 `window.DOMPurify`를 확인하고 `try/catch`로 감싸 페이지 로드를 깨지 않도록 할 것. +## 2026-07-12 - Strict CSP in Component Gallery +**Vulnerability:** Weak Content-Security Policy due to lack of headers and usage of inline scripts/styles in `components/index.html`. +**Learning:** Adding a strict CSP (`style-src 'self'`) breaks inline HTML style attributes and inline `data:` image URIs in CSS, requiring extraction into CSS classes and explicit scheme additions (e.g., `img-src 'self' data:;`). +**Prevention:** Always refactor inline `
.krds-select · Figma Selection/Select 56:29
-.krds-alert · Figma Layout/Critical Alert
-