Skip to content

[INFRA-1243] fix: parse pasted editor HTML inertly - #10307

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix/infra-1243-paste-inert-parse
Nov 16, 2026
Merged

sriramveeraghanta merged 1 commit into
previewfrom
fix/infra-1243-paste-inert-parse

Conversation

@pablohashescobar

Copy link
Copy Markdown
Member

Description

processAssetDuplication assigned clipboard HTML from the editor's custom clipboard type to innerHTML of an element created in the page's document, before ProseMirror parsed it. Markup in that element can load resources and run inline handlers even though it is never attached.

It now parses the string with new DOMParser().parseFromString(html, "text/html") and works on that inert document's body, as helpers/parser.ts already does. Input, output and the handler loop are unchanged.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

  • New packages/editor/src/helpers/__tests__/paste-asset.test.ts: handlers receive elements that do not belong to the page's document (fails without the fix), and the processed output for a normal image and for an http source is unchanged. Editor suite: 15 passed.
  • The test environment (happy-dom) does not run inline handlers, so "the handler does not run" is not asserted directly.

Not run in a browser. Please check manually: copy and paste an image between two editors.

References

  • INFRA-1243

Created with Claude Code

Clipboard markup is now parsed with DOMParser instead of being assigned to an element of the page's document, so it cannot load or run anything while image-components are prepared for duplication.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 23:04
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0715aaca-64ae-4a26-a4d4-fcebeaf8152d
Commits

Reviewing files that changed from the base of the PR and between 290383d and c214ca3.

Files selected for processing: 2

  • packages/editor/src/helpers/__tests__/paste-asset.test.ts
  • packages/editor/src/helpers/paste-asset.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit c214ca3.

@makeplane

makeplane Bot commented Nov 15, 2026

Copy link
Copy Markdown

@pablohashescobar pablohashescobar changed the title [INFRA-1243] fix(security): parse pasted editor HTML inertly [INFRA-1243] fix: parse pasted editor HTML inertly Nov 16, 2026

@sriramveeraghanta sriramveeraghanta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Only the text/plane-editor-html path changes, and external paste already went through ProseMirror's inert parser.

@sriramveeraghanta
sriramveeraghanta merged commit 5f49f1b into preview Nov 16, 2026
15 checks passed
@sriramveeraghanta
sriramveeraghanta deleted the fix/infra-1243-paste-inert-parse branch November 16, 2026 20:23
sriramveeraghanta pushed a commit that referenced this pull request Nov 16, 2026
Clipboard markup is now parsed with DOMParser instead of being assigned to an element of the page's document, so it cannot load or run anything while image-components are prepared for duplication.
Pawel-Kranzberg pushed a commit to klazwi/pi-plane that referenced this pull request Nov 18, 2026
Clipboard markup is now parsed with DOMParser instead of being assigned to an element of the page's document, so it cannot load or run anything while image-components are prepared for duplication.

(cherry picked from commit 143f247)
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