trackslash
VAULT-64 P2

Make copying from text being edited, and dragging codes out, follow the clipboard settings

0
All issues

Description

Follow-up from VAULT-38 (#637). That change routes every copy from read-only text through Vault's Pasteboard policy: Clear Clipboard, Universal Clipboard and concealed marking. Two paths still skip it:

  • Cut and Copy inside text fields being edited. This covers the note editor, a code's setup key, recovery phrase words and passphrase, descriptions and so on. They're SwiftUI TextField/TextEditors, which have no copy hook. What's copied goes to the system clipboard with no expiry, and it syncs over Universal Clipboard whatever the settings say (MANIFESTO.md C7).
    • Fixing this means UIKit-backed inputs that override copy(_:) and cut(_:).
    • They must keep everything VAULT-54's secretTextInput sets up (no learning, no Writing Tools) and secure entry for passwords.
  • Dragging a code card out of the feed. This drops the code into another app as plain text (VaultItem+Transferable). It's drag and drop, not the clipboard, so it doesn't sync or linger. But it ignores the settings, and it lets a code leave the app without a copy.
    • Decide whether to keep it, gate it behind the Universal Clipboard setting, or drop it.

Tests: unit tests that cut and copy in each editor go through the policy, plus a check on drag behaviour.

Sub-issues

0

Linked issues

0

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/vault-app/pull/663 (merged as 905c31e5).

Cut and Copy in text being edited now go through Vault's Pasteboard: Clear Clipboard's expiry, the Universal Clipboard settings and concealed marking.

  • How: I didn't rebuild the inputs in UIKit. SwiftUI draws its fields and editors with subclasses of UITextField/UITextView whose copy(_:)/cut(_:) call through to the base classes' own. EditedTextClipboard, installed at launch, replaces those two.
  • What Cut and Copy do: the selection goes to Pasteboard.copy, and Cut then deletes it with deleteBackward(), so SwiftUI's binding follows. This covers the edit menu and ⌘C/⌘X alike, in every field, with no field rewritten and nothing raw ever reaching the clipboard. A secure field still copies nothing.
  • What text is copied as: LabeledTextField(copyingAs:) tells the clipboard what its text is while focused. The note's contents follow the Notes switch. Everything else (setup key, descriptions, passphrases, recovery phrase words, search) stays on this device.

Dragging a code card out: dropped. A card now offers only its ID, which is all reordering the feed needs, and no text for another app. VAULT-38 already turned off dragging selectable text out for the same reason: it skips the settings, and on an iPad it can reach another device over Universal Control whatever Universal Clipboard allows. Tap or Copy Code still copies a code.

Testing:

  • New EditedTextClipboardTests cover copy and cut in a text field, a text editor and a vertical text field, the Notes setting, secure fields, and the drag's content types.
  • In the Simulator, ⌘X in a new code's Key field showed "Copied", emptied the field, disabled Continue, and put the key on the clipboard.

Not covered: dragging selected text out of a field being edited, which UIKit still allows, would also skip the settings. Turning it off needs each field's drag interaction. Say if you want it done.