Skip to content

feat(options): add CSP support with trustedTypePolicy#2220

Merged
remarkablemark merged 5 commits intoremarkablemark:masterfrom
LiveHelperChat:csp
May 5, 2026
Merged

feat(options): add CSP support with trustedTypePolicy#2220
remarkablemark merged 5 commits intoremarkablemark:masterfrom
LiveHelperChat:csp

Conversation

@remdex
Copy link
Copy Markdown
Contributor

@remdex remdex commented May 4, 2026

What is the motivation for this pull request?

Feature

Closes #2224

What is the current behavior?

CSP based on ideas from remarkablemark/html-dom-parser#1439

What is the new behavior?

let trustedHtml = (window.trustedTypes && window.trustedTypes.createPolicy)
                ? window.trustedTypes.createPolicy('csp-react-html', {createHTML: function(s) { return s; }})
                : null;

root.render(parse('<h1>HTMLReactParser loaded with Webpack</h1>',{
   trustedTypePolicy : trustedHtml
}));

@remdex remdex requested a review from remarkablemark as a code owner May 4, 2026 12:33
@remarkablemark remarkablemark added the feature New feature or request label May 4, 2026
Comment thread src/types.ts Outdated
Comment thread __tests__/options/trusted-type-policy.test.ts
@remarkablemark remarkablemark changed the title CSP based on ideas from #1123 feat(options): add CSP support with trustedTypePolicy May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (11370e5) to head (88a197f).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          126       127    +1     
  Branches        48        48           
=========================================
+ Hits           126       127    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

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

LGTM!

@remarkablemark remarkablemark merged commit 0fd3aa0 into remarkablemark:master May 5, 2026
12 of 13 checks passed
@remarkablemark
Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants