Skip to content

πŸ›‘οΈ Sentinel: [security improvement] CSP Trusted Types μ •μ±… 및 DOMPurify μ†Œλ… μΆ”κ°€#42

Merged
github-actions[bot] merged 5 commits into
mainfrom
sentinel/csp-trusted-types-1006353573105115304
Jul 10, 2026
Merged

πŸ›‘οΈ Sentinel: [security improvement] CSP Trusted Types μ •μ±… 및 DOMPurify μ†Œλ… μΆ”κ°€#42
github-actions[bot] merged 5 commits into
mainfrom
sentinel/csp-trusted-types-1006353573105115304

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

🚨 Severity: HIGH
πŸ’‘ Vulnerability: μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ— Trusted Types 정책이 κ°•μ œλ˜μ§€ μ•Šμ•„, μΆ”ν›„ DOM sink(예: innerHTML)에 μ‹ λ’°ν•  수 μ—†λŠ” 데이터가 할당될 경우 DOM 기반 XSS 곡격에 λ…ΈμΆœλ  μœ„ν—˜μ΄ μ‘΄μž¬ν–ˆμŠ΅λ‹ˆλ‹€.
🎯 Impact: κ³΅κ²©μžκ°€ μ•…μ„± 슀크립트λ₯Ό μ£Όμž…ν•˜μ—¬ μ‚¬μš©μž λΈŒλΌμš°μ €μ—μ„œ μž„μ˜μ˜ μ½”λ“œλ₯Ό μ‹€ν–‰ν•˜κ±°λ‚˜ μ„Έμ…˜μ„ νƒˆμ·¨ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
πŸ”§ Fix: index.html의 CSP 섀정에 require-trusted-types-for 'script' μ§€μ‹œμ–΄λ₯Ό μΆ”κ°€ν•˜κ³ , ν™•λ¦½λœ λ³΄μ•ˆ 라이브러리인 DOMPurifyλ₯Ό μ‚¬μš©ν•΄ μž…λ ₯을 μ•ˆμ „ν•˜κ²Œ μ†Œλ…ν•˜λŠ” κΈ°λ³Έ(default) Trusted Types 정책을 security.js에 λ“±λ‘ν–ˆμŠ΅λ‹ˆλ‹€. 이λ₯Ό 톡해 DOM sink에 λ¬Έμžμ—΄μ΄ 할당될 λ•Œ μžλ™μœΌλ‘œ μ•ˆμ „ν•œ TrustedHTML둜 λ³€ν™˜λ˜λ„λ‘ ν•˜μ—¬ XSSλ₯Ό λ°©μ–΄ν•˜κ³  ν¬λ‘œλ―Έμ›€ 기반 λΈŒλΌμš°μ €μ—μ„œμ˜ μΆ©λŒμ„ μ˜ˆλ°©ν–ˆμŠ΅λ‹ˆλ‹€.
βœ… Verification: κΈ°μ‘΄ i18n ν…ŒμŠ€νŠΈ μŠ€ν¬λ¦½νŠΈμ™€ λ™μΌν•œ ν™˜κ²½μ—μ„œ 둜컬 Playwright 슀크립트λ₯Ό 톡해 μ•±μ˜ 정상 λ‘œλ”©κ³Ό ν…ŒμŠ€νŠΈ 톡과λ₯Ό ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€. λΈŒλΌμš°μ € μ½˜μ†”μ—μ„œ Trusted Types μ •μ±… μœ„λ°˜ 였λ₯˜λ‚˜ DOMPurify둜 μΈν•œ 좩돌이 λ°œμƒν•˜μ§€ μ•ŠμŒμ„ κ²€μ¦ν–ˆμŠ΅λ‹ˆλ‹€.


PR created automatically by Jules for task 1006353573105115304 started by @seonghobae

Copilot AI review requested due to automatic review settings July 1, 2026 16:33
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the static site against DOM-based XSS by enforcing Trusted Types via CSP and registering a default Trusted Types policy backed by DOMPurify, with supporting documentation updates.

Changes:

  • Add require-trusted-types-for 'script' to the CSP meta tag in index.html.
  • Introduce security.js to register a default Trusted Types policy that sanitizes HTML via DOMPurify.
  • Vendor DOMPurify (assets/dompurify.min.js) and document the Sentinel security learning in .jules/sentinel.md.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
index.html Enforces Trusted Types in CSP and loads DOMPurify + the default policy script.
security.js Registers a default Trusted Types policy that sanitizes HTML with DOMPurify.
assets/dompurify.min.js Adds vendored DOMPurify runtime used by the Trusted Types policy.
.jules/sentinel.md Documents the Trusted Types hardening rationale and prevention guidance.

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread security.js Outdated
Comment thread index.html Outdated
Comment thread .jules/sentinel.md Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human or review-agent thread evidence on the current pull request.
  • Root cause: Reviewer and review-agent feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed reviewer thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE, including bot review agents other than OpenCode itself.

Review thread evidence

Latest unresolved reviewer thread evidence

security.js line 7

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T16:36:27Z
  • Comment URL: #42 (comment)
  • Comment excerpt: 'trustedTypes.createPolicy('default', …)' can throw (e.g., if a default policy already exists), which would break page load. Also, the guard checks 'window.trustedTypes' but then uses the unqualified 'trustedTypes' identifier, and the policy assumes DOMPurify is always present. Consider using 'window.trustedTypes' consistently, checking 'window.DOMPurify', and wrapping policy creation in a try/catch so the page still loads if policy creation fails.

index.html line 28

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T16:36:27Z
  • Comment URL: #42 (comment)
  • Comment excerpt: The newly added scripts are render-blocking because they omit 'defer', while 'i18n.js' is already deferred. Since these scripts don't appear to be needed during initial HTML parsing, deferring them will avoid blocking and keep script execution order (DOMPurify β†’ security policy β†’ i18n) intact.

.jules/sentinel.md line 19

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T16:36:27Z

  • Comment URL: #42 (comment)

  • Comment excerpt: In Chromium, Trusted Types enforcement typically throws a Trusted Types violation (e.g., a TypeError) rather than "crashing" the browser. Rewording avoids ambiguity and keeps the doc technically precise.

  • Result: REQUEST_CHANGES

  • Reason: unresolved reviewer or review-agent thread(s) were present before approval.

  • Head SHA: d2338c5e7cae34c3d4c99f42ebe9b0751e94d94a

  • Workflow run: 28532676057

  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: c004494a2347f4423ba1c41fb798e352c354a6e4
  • Workflow run: 29085141257
  • Workflow attempt: 1
  • Gate result: APPROVE (approval step)

Pull request overview

OpenCode reviewed the current-head bounded evidence and found no blocking issues.

Findings

No blocking findings.

Summary

Approval sufficiency: bounded evidence supplied affirmative approval evidence for changed files, coverage/docstring posture, risk surfaces, and current-head verification; approval is not based merely on the absence of known blockers.
Verification posture: CodeGraph evidence was initialized and bounded current-head evidence reviewed for changed-file evidence including .jules/sentinel.md, assets/dompurify.min.js, index.html, security.js.
Linter/static: workflow/static review evidence is bounded by the current-head GitHub Checks gate and changed-file evidence.
TDD/regression: coverage execution evidence and focused changed hunks were reviewed from bounded-review-evidence.md.
Coverage: coverage execution evidence reports test coverage as not applicable because no supported changed source files or package manifests were found.
Docstring coverage: coverage execution evidence reports docstring coverage as not applicable because no supported changed source files or package manifests were found.
DAG: CodeGraph/source-backed behavior map connects .jules/sentinel.md to the affected review, runtime, or workflow path and required checks.
PoC/execution: coverage-evidence job executed on the current head and reported PASS.
DDD/domain: workflow and repository-governance invariants were reviewed against changed files in bounded evidence.
CDD/context: CodeGraph evidence, changed-file history, and focused hunks were reviewed from bounded-review-evidence.md.
Similar issues: changed-file history evidence was reviewed for comparable local precedents.
Claim/concept check: bounded evidence, repository source, current-head workflow evidence, and, where numeric, scientific, statistical, or literature-backed claims are affected, original-paper/formula evidence and parameter-recovery expectations were used for claims.
Standards search: standards and external-source checks are delegated to configured OpenCode web_search/Context7/DeepWiki sources when applicable; no evidence-backed standards blocker is present in bounded evidence.
Compatibility/convention: changed workflow/script conventions, object naming, and reserved-word safety for schema/API/config/code surfaces were checked in bounded evidence.
Breaking-change/backcompat: deployment evidence and changed-file history were checked for backward-compatibility risk.
Performance: changed surfaces were checked for performance risk in bounded evidence.
Developer experience: changed automation, review, test, setup, and maintenance surfaces were checked for helpful or obstructive DX impact in bounded evidence.
User experience: connected user, operator, API, CLI, documentation, review-comment, status-check, rendering, and workflow-reader behavior was checked for contradictions against code, docs, and tests in bounded evidence.
Visual/DOM: Playwright visual, DOM locator, ARIA snapshot, console, and responsive evidence were checked when a web UI surface was present; for non-web surfaces, API/CLI/log/docs/workflow interaction evidence was reviewed instead.
Accessibility/i18n: accessibility, localization, and human-readable text surfaces were checked where UI, CLI, API message, docs, logs, or review text changed.
Supply-chain/license: dependency, package, model, container, and external-tool changes were checked in bounded evidence.
Packaging: package, build, test, lint, and security contracts were checked in bounded evidence.
Security/privacy: workflow-token, review-gate, and repository-automation security/privacy boundaries were checked in bounded evidence.

  • Result: APPROVE
  • Reason: Trusted Types enforcement + DOMPurify added; no blocking regressions found.
  • Head SHA: c004494a2347f4423ba1c41fb798e352c354a6e4
  • Workflow run: 29085141257
  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

seonghobae and others added 3 commits July 7, 2026 19:14
- wrap trustedTypes.createPolicy in try/catch so a throw (e.g. an existing
  'default' policy or CSP restriction) no longer breaks page load
- use window.trustedTypes consistently instead of the unqualified global
- guard window.DOMPurify before using it in createHTML

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C2Mig78TxShv22uBcr7pCo
opencode-agent[bot]
opencode-agent Bot previously approved these changes Jul 7, 2026

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode reviewed the current-head bounded evidence and found no blocking issues.

Findings

No blocking findings.

Summary

Approval sufficiency: bounded evidence supplied affirmative approval evidence for changed files, coverage/docstring posture, risk surfaces, and current-head verification; approval is not based merely on the absence of known blockers.
Verification posture: CodeGraph evidence was initialized and bounded current-head evidence reviewed for changed-file evidence including .jules/sentinel.md, assets/dompurify.min.js, index.html, security.js.
Linter/static: workflow/static review evidence is bounded by the current-head GitHub Checks gate and changed-file evidence.
TDD/regression: coverage execution evidence and focused changed hunks were reviewed from bounded-review-evidence.md.
Coverage: coverage execution evidence reports test coverage as not applicable because no supported changed source files or package manifests were found.
Docstring coverage: coverage execution evidence reports docstring coverage as not applicable because no supported changed source files or package manifests were found.
DAG: CodeGraph/source-backed behavior map connects .jules/sentinel.md to the affected review, runtime, or workflow path and required checks.
PoC/execution: coverage-evidence job executed on the current head and reported PASS.
DDD/domain: workflow and repository-governance invariants were reviewed against changed files in bounded evidence.
CDD/context: CodeGraph evidence, changed-file history, and focused hunks were reviewed from bounded-review-evidence.md.
Similar issues: changed-file history evidence was reviewed for comparable local precedents.
Claim/concept check: bounded evidence, repository source, current-head workflow evidence, and, where numeric, scientific, statistical, or literature-backed claims are affected, original-paper/formula evidence and parameter-recovery expectations were used for claims.
Standards search: standards and external-source checks are delegated to configured OpenCode web_search/Context7/DeepWiki sources when applicable; no evidence-backed standards blocker is present in bounded evidence.
Compatibility/convention: changed workflow/script conventions, object naming, and reserved-word safety for schema/API/config/code surfaces were checked in bounded evidence.
Breaking-change/backcompat: deployment evidence and changed-file history were checked for backward-compatibility risk.
Performance: changed surfaces were checked for performance risk in bounded evidence.
Developer experience: changed automation, review, test, setup, and maintenance surfaces were checked for helpful or obstructive DX impact in bounded evidence.
User experience: connected user, operator, API, CLI, documentation, review-comment, status-check, rendering, and workflow-reader behavior was checked for contradictions against code, docs, and tests in bounded evidence.
Visual/DOM: Playwright visual, DOM locator, ARIA snapshot, console, and responsive evidence were checked when a web UI surface was present; for non-web surfaces, API/CLI/log/docs/workflow interaction evidence was reviewed instead.
Accessibility/i18n: accessibility, localization, and human-readable text surfaces were checked where UI, CLI, API message, docs, logs, or review text changed.
Supply-chain/license: dependency, package, model, container, and external-tool changes were checked in bounded evidence.
Packaging: package, build, test, lint, and security contracts were checked in bounded evidence.
Security/privacy: workflow-token, review-gate, and repository-automation security/privacy boundaries were checked in bounded evidence.

  • Result: APPROVE
  • Reason: Security improvements for CSP Trusted Types and DOMPurify sanitization are correctly implemented.
  • Head SHA: 92af78d394139eacde15c6661d6458961a9bede7
  • Workflow run: 28859693160
  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode reviewed the current-head bounded evidence and found no blocking issues.

Findings

No blocking findings.

Summary

Approval sufficiency: bounded evidence supplied affirmative approval evidence for changed files, coverage/docstring posture, risk surfaces, and current-head verification; approval is not based merely on the absence of known blockers.
Verification posture: CodeGraph evidence was initialized and bounded current-head evidence reviewed for changed-file evidence including .jules/sentinel.md, assets/dompurify.min.js, index.html, security.js.
Linter/static: workflow/static review evidence is bounded by the current-head GitHub Checks gate and changed-file evidence.
TDD/regression: coverage execution evidence and focused changed hunks were reviewed from bounded-review-evidence.md.
Coverage: coverage execution evidence reports test coverage as not applicable because no supported changed source files or package manifests were found.
Docstring coverage: coverage execution evidence reports docstring coverage as not applicable because no supported changed source files or package manifests were found.
DAG: CodeGraph/source-backed behavior map connects .jules/sentinel.md to the affected review, runtime, or workflow path and required checks.
PoC/execution: coverage-evidence job executed on the current head and reported PASS.
DDD/domain: workflow and repository-governance invariants were reviewed against changed files in bounded evidence.
CDD/context: CodeGraph evidence, changed-file history, and focused hunks were reviewed from bounded-review-evidence.md.
Similar issues: changed-file history evidence was reviewed for comparable local precedents.
Claim/concept check: bounded evidence, repository source, current-head workflow evidence, and, where numeric, scientific, statistical, or literature-backed claims are affected, original-paper/formula evidence and parameter-recovery expectations were used for claims.
Standards search: standards and external-source checks are delegated to configured OpenCode web_search/Context7/DeepWiki sources when applicable; no evidence-backed standards blocker is present in bounded evidence.
Compatibility/convention: changed workflow/script conventions, object naming, and reserved-word safety for schema/API/config/code surfaces were checked in bounded evidence.
Breaking-change/backcompat: deployment evidence and changed-file history were checked for backward-compatibility risk.
Performance: changed surfaces were checked for performance risk in bounded evidence.
Developer experience: changed automation, review, test, setup, and maintenance surfaces were checked for helpful or obstructive DX impact in bounded evidence.
User experience: connected user, operator, API, CLI, documentation, review-comment, status-check, rendering, and workflow-reader behavior was checked for contradictions against code, docs, and tests in bounded evidence.
Visual/DOM: Playwright visual, DOM locator, ARIA snapshot, console, and responsive evidence were checked when a web UI surface was present; for non-web surfaces, API/CLI/log/docs/workflow interaction evidence was reviewed instead.
Accessibility/i18n: accessibility, localization, and human-readable text surfaces were checked where UI, CLI, API message, docs, logs, or review text changed.
Supply-chain/license: dependency, package, model, container, and external-tool changes were checked in bounded evidence.
Packaging: package, build, test, lint, and security contracts were checked in bounded evidence.
Security/privacy: workflow-token, review-gate, and repository-automation security/privacy boundaries were checked in bounded evidence.

  • Result: APPROVE
  • Reason: Trusted Types enforcement + DOMPurify added; no blocking regressions found.
  • Head SHA: c004494a2347f4423ba1c41fb798e352c354a6e4
  • Workflow run: 29085141257
  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

@seonghobae seonghobae dismissed github-actions[bot]’s stale review July 10, 2026 10:18

Superseded by current-head c004494 approval; all review threads are resolved/outdated, code scanning is empty, and Strix/OSV/Trivy/dependency-review/OpenCode checks passed.

@github-actions github-actions Bot merged commit 5085339 into main Jul 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants