From 3feb9d3878a848348eb5f8f720f4f87a9ceb534b Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Fri, 31 Jul 2026 14:02:51 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20[security?=
=?UTF-8?q?=20improvement]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
๐จ Severity: MEDIUM
๐ก Vulnerability: index.html์ Content-Security-Policy์ base-uri 'self'๊ฐ ์ค์ ๋์ด ์์ด, HTML ์ฃผ์
์ทจ์ฝ์ ์ด ์กด์ฌํ ๊ฒฝ์ฐ Base ํ๊ทธ ์ธ์ ์
๊ณต๊ฒฉ์ ๋
ธ์ถ๋ ์ ์์.
๐ฏ Impact: ๊ณต๊ฒฉ์๊ฐ ์
์์ ์ธ ํ๊ทธ๋ฅผ ์ฃผ์
ํ๋ฉด ์๋ ๊ฒฝ๋ก๋ก ๋ก๋๋๋ ์คํฌ๋ฆฝํธ๋ ์คํ์ผ์ํธ๊ฐ ๊ณต๊ฒฉ์์ ๋๋ฉ์ธ์์ ๋ก๋๋์ด ์ถ๊ฐ์ ์ธ ๊ณต๊ฒฉ(์: XSS)์ผ๋ก ์ด์ด์ง ์ ์์.
๐ง Fix: CSP์ base-uri ์ง์์ด๋ฅผ 'none'์ผ๋ก ๋ณ๊ฒฝํ์ฌ Base ํ๊ทธ ์ธ์ ์
์ ์์ฒ์ ์ผ๋ก ์ฐจ๋จํจ. ์ ์ ์ฌ์ดํธ์ด๋ฏ๋ก ํ๊ทธ๊ฐ ํ์ํ์ง ์์.
โ
Verification: pytest tests/๋ฅผ ์คํํ์ฌ CSP base-uri ํ
์คํธ๊ฐ ํต๊ณผํ๋์ง ํ์ธํจ.
---
.jules/sentinel.md | 4 ++++
CHANGELOG.md | 1 +
index.html | 2 +-
tests/test_index_security.py | 18 ++++++++++++++++++
4 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 tests/test_index_security.py
diff --git a/.jules/sentinel.md b/.jules/sentinel.md
index 4f173bc..9223ef3 100644
--- a/.jules/sentinel.md
+++ b/.jules/sentinel.md
@@ -38,3 +38,7 @@
**Vulnerability:** Missing input validation on `setLanguage()` could allow invalid strings (like Prototype Pollution payloads or arbitrary text) to be applied to the DOM (`lang` attribute) and stored in `localStorage`.
**Learning:** The global `setLanguage` function assumed inputs would only come from predefined button clicks, skipping runtime validation.
**Prevention:** Always sanitize and validate function arguments at the application boundary, even if the primary caller is trusted, to enforce defense in depth.
+## 2026-07-31 - Enforce strict base-uri in CSP
+**Vulnerability:** The Content Security Policy in `index.html` allowed `base-uri 'self'`, which could potentially allow base tag injection if an attacker finds a way to inject HTML.
+**Learning:** Static sites that do not explicitly require a `` tag should use `base-uri 'none'` instead of `base-uri 'self'` to completely neutralize base tag injection attacks.
+**Prevention:** Always configure `base-uri 'none'` in the baseline CSP for static sites to prevent base tag injection attacks.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56ad628..9c9907e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
# CHANGELOG
## [Unreleased]
+- **๋ณด์ ๊ฐ์ **: `index.html`์ Content-Security-Policy(CSP)์ `base-uri 'none'`์ ์ค์ ํ์ฌ Base ํ๊ทธ ์ธ์ ์
๊ณต๊ฒฉ์ ๋ฐฉ์งํ๋๋ก ๋ณด์์ ๊ฐํํ์ต๋๋ค.
- **๋ณด์ ๊ฐ์ **: ์ปดํฌ๋ํธ ๊ฐค๋ฌ๋ฆฌ์ ์ธ๋ผ์ธ ์คํฌ๋ฆฝํธ์ ์คํ์ผ์ ์ธ๋ถ ํ์ผ๋ก ๋ถ๋ฆฌํ๊ณ , ์๊ฒฉํ Content-Security-Policy๋ฅผ ์ ์ฉํด XSS ๋ฐฉ์ด๋ฅผ ๊ฐํํ์ต๋๋ค.
- **์ฑ๋ฅ ํ๊ท ๋ณต์**: ์คํ์คํฌ๋ฆฐ `.section` ๋ ๋๋ง์ `content-visibility: auto`๋ก ์ง์ฐํ๊ณ , ์ผ๋ฐ ์น์
์ 600pxยท์ฝํ
์ธ ๊ฐ ํฐ DIKW/projects ์น์
์ 1000px์ `contain-intrinsic-size` placeholder๋ฅผ ์ ์งํด ์ด๊ธฐ ๋ ๋๋ง ๋น์ฉ๊ณผ ์คํฌ๋กค๋ฐ ์ด๋์ ํจ๊ป ์ค์์ต๋๋ค.
- **๋ณด์ ๊ฐ์ **: Trusted Types ๊ธฐ๋ฐ CSP ๊ฐํ: ์ ์ฌ์ ์ธ DOM ๊ธฐ๋ฐ XSS ๊ณต๊ฒฉ์ ๋ฐฉ์งํ๊ธฐ ์ํด `require-trusted-types-for 'script'` ์ง์์ด ์ถ๊ฐ
diff --git a/index.html b/index.html
index c40fea3..25ee55a 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
-
+
๋งฅ๋ฝ์งํ ์ฐ๊ตฌ์ค | Contextual Wisdom Lab
None:
+ """The main index.html enforces a strict base-uri to prevent base tag injection."""
+ html = INDEX.read_text(encoding="utf-8")
+ match = re.search(
+ r'