[verify] Pasting an image copied from a web page must send only the image (no page URL / alt text) #132

Closed
opened 2026-09-17 16:10:05 -04:00 by jared · 1 comment
Owner

When copying an image from a web page, browsers put both the bitmap (image/png) and an text/html fragment (<img src="https://site/…" alt="…">) on the clipboard. Verify the paste path (useFilePasteHandler + Slate's default HTML/text insertion): confirm that only the file upload happens and no <img src=…>/URL text is inserted into the composer or sent as body/formatted_body.

If any leak exists: when the clipboard contains files, preventDefault() the text/html insertion entirely. Add a unit test on the decision helper.

When copying an image from a web page, browsers put both the bitmap (`image/png`) and an `text/html` fragment (`<img src="https://site/…" alt="…">`) on the clipboard. Verify the paste path (`useFilePasteHandler` + Slate's default HTML/text insertion): confirm that only the file upload happens and no `<img src=…>`/URL text is inserted into the composer or sent as body/formatted_body. If any leak exists: when the clipboard contains files, `preventDefault()` the text/html insertion entirely. Add a unit test on the decision helper.
jared added this to the Features 2026-Q4 milestone 2026-09-17 16:10:05 -04:00
jared added the enhancementpriority: mediumsecurityarea: mediaresearch labels 2026-09-17 16:10:05 -04:00
jared self-assigned this 2026-09-17 16:10:05 -04:00
Author
Owner

Verified headless: dispatched a paste into the composer with a DataTransfer carrying the PNG plus text/html <img src="https://evil.example/tracking/pic.png?utm_source=x" alt="Secret alt text"> plus text/plain with that URL. Result: the upload card for image.png appeared and the composer stayed empty — no URL, no alt text; nothing but the file would be sent.

Made it explicit anyway (last commit): useFilePasteHandler now preventDefault()s whenever the clipboard carries files, so the editor's own HTML/text insertion can never run beside a file paste even if the Slate plugins change. Closing.

Verified headless: dispatched a paste into the composer with a `DataTransfer` carrying the PNG **plus** `text/html` `<img src="https://evil.example/tracking/pic.png?utm_source=x" alt="Secret alt text">` **plus** `text/plain` with that URL. Result: the upload card for `image.png` appeared and the composer stayed empty — no URL, no alt text; nothing but the file would be sent. Made it explicit anyway (last commit): `useFilePasteHandler` now `preventDefault()`s whenever the clipboard carries files, so the editor's own HTML/text insertion can never run beside a file paste even if the Slate plugins change. Closing.
jared closed this issue 2026-09-19 17:28:28 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#132