๐ก๏ธ Sentinel: [๋ณด์ ๊ฐ์ ] ๋ฉ์ธ ํ์ด์ง CSP ๊ฐํ ๋ฐ ๊ฒ์ฆ ํ ์คํธ ์ถ๊ฐ#97
๐ก๏ธ Sentinel: [๋ณด์ ๊ฐ์ ] ๋ฉ์ธ ํ์ด์ง CSP ๊ฐํ ๋ฐ ๊ฒ์ฆ ํ
์คํธ ์ถ๊ฐ#97seonghobae wants to merge 1 commit into
Conversation
๋ฉ์ธ ํ์ด์ง(`index.html`)์ Content-Security-Policy๋ฅผ `default-src 'none'` ๊ธฐ๋ฐ์ ์๊ฒฉํ ํ์ดํธ๋ฆฌ์คํธ ๋ฐฉ์์ผ๋ก ๊ฐํํ์ฌ ์ ์ฌ์ ์ธ ๊ณต๊ฒฉ ํ๋ฉด์ ์ต์ํํ์ต๋๋ค. ์ด๋ฅผ ๊ฒ์ฆํ๋ `test_index_security.py` ํ๊ท ํ ์คํธ๋ฅผ ์ถ๊ฐํ์ต๋๋ค.
|
๐ Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a ๐ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR hardens the static siteโs main entrypoint (index.html) by switching to a strict deny-by-default Content Security Policy (CSP) and adding Python regression tests to prevent future CSP loosening or inline active-content regressions.
Changes:
- Strengthen
index.htmlCSP todefault-src 'none'with explicit allowlists for required asset types and stronger restrictions (base-uri 'none',frame-src 'none', Trusted Types enforcement). - Add
tests/test_index_security.pyto assert the strict CSP is present and that no inline<style>, inline<script>,style=, oron*=handlers exist. - Document the security change in
CHANGELOG.mdand record the security learning in.jules/sentinel.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
index.html |
Replaces permissive CSP with a strict allowlist CSP suitable for a static GitHub Pages site. |
tests/test_index_security.py |
Adds regression tests that enforce strict CSP presence and absence of inline active content. |
CHANGELOG.md |
Notes the CSP hardening under [Unreleased] for user-facing security changes. |
.jules/sentinel.md |
Captures the CSP hardening lesson to prevent future regressions. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
๐จ Severity: HIGH
๐ก Vulnerability: ๋ฉ์ธ
index.html์ด ๋์จํdefault-src 'self'CSP์base-uri 'self'๋ฅผ ์ฌ์ฉํ๊ณ ์์ด, ์๊ฒฉํ ๊ฑฐ๋ถ ๊ธฐ๋ณธ(deny-by-default) ์ ๊ทผ ๋ฐฉ์๋ณด๋ค ์ทจ์ฝํ์ต๋๋ค. ์ธ๋ถ ์คํฌ๋ฆฝํธ๋ ๋์ ์ฝํ ์ธ ๊ฐ ์ถํ ์ถ๊ฐ๋ ๊ฒฝ์ฐ ๊ณต๊ฒฉ ํ๋ฉด์ด ๋์ ์ํ์์ต๋๋ค.๐ฏ Impact: ํฅํ ์์ ํ์ง ์์ DOM ์ฑํฌ๊ฐ ๋์ ๋๊ฑฐ๋ ์๋ํํฐ ์คํฌ๋ฆฝํธ๊ฐ ํผ์๋ ๊ฒฝ์ฐ, XSS๋ ๋ฐ์ดํฐ ์ฃผ์ ๊ณต๊ฒฉ์ ๋ ธ์ถ๋ ์ ์์ต๋๋ค.
๐ง Fix:
index.html์ CSP๋ฅผdefault-src 'none'์ผ๋ก ๋ณ๊ฒฝํ๊ณ , ํ์ํ ์์ฐ๋ง ๋ช ์์ ์ผ๋ก ํ์ฉ(script-src 'self',style-src 'self'๋ฑ)ํ๋๋ก ๊ฐํํ์ต๋๋ค. ๋ํbase-uri์object-src๋ฅผ'none'์ผ๋ก ์ค์ ํ์ต๋๋ค.โ Verification: ์ด ๋ณ๊ฒฝ ์ฌํญ์ ์ ์งํ๊ณ ๊ฒ์ฆํ๊ธฐ ์ํด
tests/test_index_security.pyํ๊ท ํ ์คํธ๋ฅผ ์ถ๊ฐํ์ต๋๋ค. ํ ์คํธ ์ค์ํธ๊ฐ ๋ชจ๋ ์ ์ ํต๊ณผํฉ๋๋ค.PR created automatically by Jules for task 10918979539190325931 started by @seonghobae