Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b76c46dfef5b1e2573af36b3296c91239d6f038
      
https://github.com/WebKit/WebKit/commit/4b76c46dfef5b1e2573af36b3296c91239d6f038
  Author: John Cardullo <[email protected]>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M Source/WebCore/dom/DataTransfer.cpp
    M Source/WebCore/dom/DataTransfer.h
    M Source/WebCore/platform/glib/PasteboardGLib.cpp

  Log Message:
  -----------
  [GLib][GTK] Allow pasting in-memory image data from clipboard

https://bugs.webkit.org/show_bug.cgi?id=325114

Reviewed by Michael Catanzaro and Adrian Perez de Castro.

In 303828@main (89838b9164a1), DataTransfer::allowsFileAccess() was hardcoded to
return false on all non-Cocoa ports to mitigate CVE-2025-13947 (bug #303434)
regarding drag-and-drop file access.

However, this unintentionally broke pasting image data from the clipboard
(previously fixed in 301877@main / bug #218519), because DataTransfer::types()
and DataTransfer::filesFromPasteboardAndItemList() suppress clipboard file and 
item
access when allowsFileAccess() returns false. Pasteboard::fileContentState()
in PasteboardGLib.cpp also incorrectly returned 
FileContentState::MayContainFilePaths
instead of FileContentState::InMemoryImage when an image was present on the 
clipboard.

This patch:
1. Implements DataTransfer::allowsFileAccess() for GTK and WPE ports to allow
   file access during copy-and-paste (!forDrag()) when the pasteboard content
   state is Pasteboard::FileContentState::InMemoryImage. Because in-memory 
images
   do not reference files on disk, this does not expose local file paths and
   maintains the security fix from bug #303434. Drag-and-drop file access 
remains
   disabled for GTK/WPE until bug #271957 is resolved.
2. Updates Pasteboard::fileContentState() in PasteboardGLib.cpp to return
   FileContentState::InMemoryImage when image data is present on the clipboard
   without file paths.

* Source/WebCore/dom/DataTransfer.cpp:
(WebCore::DataTransfer::allowsFileAccess const):
* Source/WebCore/dom/DataTransfer.h:
(WebCore::DataTransfer::allowsFileAccess const):
* Source/WebCore/platform/glib/PasteboardGLib.cpp:
(WebCore::Pasteboard::fileContentState):

Canonical link: https://commits.webkit.org/321801@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to