Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 70bb79bb0b535ec8bf5788ffe846b4567b81dc76
https://github.com/WebKit/WebKit/commit/70bb79bb0b535ec8bf5788ffe846b4567b81dc76
Author: Pascoe <[email protected]>
Date: 2026-09-12 (Sat, 12 Sep 2026)
Changed paths:
A LayoutTests/ipc/mac/pasteboard-file-type-blocklist-bypass-expected.txt
A LayoutTests/ipc/mac/pasteboard-file-type-blocklist-bypass.html
M Source/WebCore/platform/PlatformPasteboard.h
M Source/WebCore/platform/mac/PlatformPasteboardMac.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PasteboardFileTypeBlocklist.mm
Log Message:
-----------
Improve pasteboard type checks on macOS
https://bugs.webkit.org/show_bug.cgi?id=313829
<rdar://problem/174712170>
Reviewed by Geoffrey Garen and Wenson Hsieh.
isFilePasteboardType() compared the WebContent-supplied string literally
against three names, but NSPasteboard canonicalises types: case-variant
UTIs, the dyn.* encoding of an NSPboardType, and the
"CorePasteboardFlavorType 0xHHHHHHHH" 4CC OSType wrapper all resolve to
the same slot as one of those three names. WebContent could therefore
declare a file-URL type the blocklist meant to forbid.
Canonicalise via UTType: resolve the input as a UTI, an NSPboardType
tag, and (after decoding the OSType wrapper) an OSType tag, and reject
anything that conforms to UTTypeFileURL or whose NSPboardType tag set
contains NSFilenamesPboardType or NSFilesPromisePboardType.
Also drop setStringForType()'s NSURLPboardType -> UTTypeFileURL mirror:
it gated canWritePasteboardType() on the incoming type while writing
under a different one.
Tests: LayoutTests/ipc/mac/pasteboard-file-type-blocklist-bypass.html
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PasteboardFileTypeBlocklist.mm
* Source/WebCore/platform/PlatformPasteboard.h:
* Source/WebCore/platform/mac/PlatformPasteboardMac.mm:
(WebCore::typeConformsToFilePasteboardType):
(WebCore::PlatformPasteboard::isFilePasteboardType):
(WebCore::canWritePasteboardType):
(WebCore::PlatformPasteboard::setStringForType):
* LayoutTests/ipc/mac/pasteboard-file-type-blocklist-bypass-expected.txt: Added.
* LayoutTests/ipc/mac/pasteboard-file-type-blocklist-bypass.html: Added.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
*
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/PasteboardFileTypeBlocklist.mm:
Added.
Originally-landed-as: [email protected] (2118b94193e7).
rdar://185368717
Canonical link: https://commits.webkit.org/320983@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications