Repository navigation
Restore the text floor when a clipboard snapshot kept only empty marker types - #354
Merged
alexkroman merged 2 commits intoNov 24, 2026
Conversation
A password manager's copy whose string was promised snapshots as an item holding nothing but the empty org.nspasteboard.ConcealedType marker. restore wrote that item back, writeObjects reported success, and the plainText floor never ran — so a successful dictation paste replaced the user's copied password with a bare marker. restore now counts an item only when it carries non-empty data, and folds plainText into the first item when no item kept a string of its own, so the text comes back with that item's markers (a concealed password stays concealed). A concealed restore is written current-host-only, matching how Blurt's own concealed writes stay off Universal Clipboard. Fixes #347 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts lifetime The restore is itself a write, so it voided the 90 s clear pending on a concealed clipboard — Blurt's own leave-behind, or a password manager's timer — and the restored secret then stayed on the clipboard indefinitely. A concealed restore now schedules its own clear. The text-floor fallback (a refused writeObjects) wrote a plain string, dropping ConcealedType and .currentHostOnly. It now goes through setString with the snapshot's concealed flag, so it gets the same markers, host scope and expiry. Also corrects PasteboardSnapshot.plainText's doc to match restorableItems, and moves the concealed tests into an extension of SystemClipboardTests (same serialized suite) to stay under the file and type-body length limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #347. Stacked on
fix/secure-flag-unresolved-read. That branch has no PR yet and holds the #348 commit, which addsSystemClipboard.concealedType. Retarget this PR tomainonce that branch lands.The bug
A password manager's copy whose string was promised (and declined) snapshots as an item that holds only the empty
org.nspasteboard.ConcealedTypemarker. EmptyData()isn't nil, so the snapshot kept it.restorewrote that marker-only item back,writeObjectsreturnedtrue, and the early return skipped theplainTextfloor. After a successful dictation paste, the user's copied password was gone.The fix (
SystemClipboard.restore)restorableItems, restores an item only if it carries non-empty data. An item with only markers is not contents..stringof its own,plainTextgoes into the first item instead of being written separately afterwards. The text then keeps that item's markers, so a concealed password comes back concealed rather than as a plain string a clipboard manager would archive.ConcealedTypeis written with.currentHostOnly, the same way Blurt's own concealed writes are kept off Universal Clipboard.Tests
New cases in
SystemClipboardTests:plainText→ the string comes back, still Concealed + Transient. Fails on the old code.plainText→ the transcript is left in place, not replaced by bare markers. Fails on the old code.writeAndPrepareRestorefrom start to finish.swift test --filter SystemClipboard: 18/18 pass.scripts/check.shfailures, none from this diff:swiftlintfile_lengthinDictationSession.swift(407) andDictationSessionContextTests.swift(431). Both come from the base branch's d97ce08.peripheryflags unusedTermField/CaretinApp/BlurtiOS/BlurtKeyboard/Sources/TermField.swift, which hasn't changed since iOS: keyboard redesign — Apple's keyboard on KeyboardKit, tap or hold to dictate #315.Review follow-up (81dcb35)
restoredConcealedClipboardExpires.writeObjectsrefuses the batch, the plain-text fallback now goes throughsetString(…, concealed:), so it gets the concealed marker, this-Mac-only scope and the 90 s clear. It no longer writes a plain string.PasteboardSnapshot.plainText's comment now matchesrestorableItems.SystemClipboardConcealedTests.swift, as an extension of the same.serializedsuite (so they still never race onNSPasteboard.general). This keeps both files under SwiftLint's file and type-body length limits.🤖 Generated with Claude Code