Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-08-02 - CSP `base-uri` ๊ฐ•ํ™”
**Vulnerability:** `base-uri 'self'` ์„ค์ •์€ ์ •์  ์‚ฌ์ดํŠธ์—์„œ ๋ถˆํ•„์š”ํ•˜๊ฒŒ `self` ์ถœ์ฒ˜์˜ base ํƒœ๊ทธ ์ฃผ์ž…์„ ํ—ˆ์šฉํ•  ์—ฌ์ง€๋ฅผ ๋‚จ๊น๋‹ˆ๋‹ค.
**Learning:** ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋™์ ์œผ๋กœ ๊ฒฝ๋กœ๋ฅผ ํ•ด์„ํ•  ๋•Œ ๊ธฐ์ค€(base) URL์„ ์•…์˜์ ์œผ๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ๋ฆฌ์†Œ์Šค๋ฅผ ๊ฐ€๋กœ์ฑ„๋Š” Base Tag Injection ๊ณต๊ฒฉ ์œ„ํ—˜์„ ์ค„์ด๋ ค๋ฉด, `<base>` ํƒœ๊ทธ๋ฅผ ์ „ํ˜€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ํ™˜๊ฒฝ์˜ ๊ฒฝ์šฐ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ `base-uri 'none'`์„ ์ ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
**Prevention:** `<base>` ํƒœ๊ทธ๊ฐ€ ๋ช…์‹œ์ ์œผ๋กœ ํ•„์š”ํ•˜์ง€ ์•Š์€ ๋ชจ๋“  ์ •์  ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ CSP ์„ค์ • ์‹œ `base-uri 'none'`์„ ๊ธฐ๋ณธ์œผ๋กœ ์ ์šฉํ•˜์—ฌ ๊ณต๊ฒฉ ํ‘œ๋ฉด์„ ์ตœ์†Œํ™”ํ•ฉ๋‹ˆ๋‹ค.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

## [Unreleased]
- **๋ณด์•ˆ ๊ฐœ์„ **: `index.html`์˜ CSP ์ •์ฑ…์—์„œ `base-uri`๋ฅผ `'none'`์œผ๋กœ ๊ฐ•ํ™”ํ•˜์—ฌ Base Tag Injection ์ทจ์•ฝ์ ์„ ์›์ฒœ ์ฐจ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.
- **๋ณด์•ˆ ๊ฐœ์„ **: ์ปดํฌ๋„ŒํŠธ ๊ฐค๋Ÿฌ๋ฆฌ์˜ ์ธ๋ผ์ธ ์Šคํฌ๋ฆฝํŠธ์™€ ์Šคํƒ€์ผ์„ ์™ธ๋ถ€ ํŒŒ์ผ๋กœ ๋ถ„๋ฆฌํ•˜๊ณ , ์—„๊ฒฉํ•œ 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'` ์ง€์‹œ์–ด ์ถ”๊ฐ€
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self'; object-src 'none'; base-uri 'self'; form-action 'none'; upgrade-insecure-requests; require-trusted-types-for 'script';">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none'; upgrade-insecure-requests; require-trusted-types-for 'script';">
<meta name="referrer" content="strict-origin-when-cross-origin">
<title>๋งฅ๋ฝ์ง€ํ˜œ ์—ฐ๊ตฌ์‹ค | Contextual Wisdom Lab</title>
<meta
Expand Down
30 changes: 30 additions & 0 deletions tests/test_index_security.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Security regression tests for the main index page."""

import re
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
INDEX = ROOT / "index.html"


def test_index_declares_strict_csp() -> None:
"""The main index page limits active content to same-origin assets."""
html = INDEX.read_text(encoding="utf-8")
match = re.search(
r'<meta\s+http-equiv="Content-Security-Policy"\s+content="([^"]+)"',
html,
)
assert match is not None, "index must declare a CSP meta policy"
policy = match.group(1)

for directive in (
"default-src 'self'",
"img-src 'self'",
"object-src 'none'",
"base-uri 'none'",
"form-action 'none'",
"upgrade-insecure-requests",
"require-trusted-types-for 'script'",
):
assert directive in policy
Loading