From 5c1f036613522406687ba77771a617d6fc239b18 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 30 Oct 2025 15:16:14 -0700 Subject: [PATCH] macos: assert only one text-plain gets written to clipboard --- macos/Sources/Ghostty/Ghostty.App.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index 9806efbe4..074b0f6d5 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -383,6 +383,11 @@ extension Ghostty { } guard !contentArray.isEmpty else { return } + // Assert there is only one text/plain entry. For security reasons we need + // to guarantee this for now since our confirmation dialog only shows one. + assert(contentArray.filter({ $0.mime == "text/plain" }).count <= 1, + "clipboard contents should have at most one text/plain entry") + if !confirm { // Declare all types let types = contentArray.compactMap { item in