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-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 `<base>` 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.
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`์˜ 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'` ์ง€์‹œ์–ด ์ถ”๊ฐ€
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
18 changes: 18 additions & 0 deletions tests/test_index_security.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Security regression tests for the main index.html."""

import re
from pathlib import Path

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

def test_index_declares_strict_base_uri() -> 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'<meta\s+http-equiv="Content-Security-Policy"\s+content="([^"]+)"',
html,
)
assert match is not None, "index.html must declare a CSP meta policy"
policy = match.group(1)
assert "base-uri 'none'" in policy, "base-uri must be set to 'none'"
Loading