trackslash
VAULT-38 P2

Make every copy in Vault follow the clipboard settings

0
All issues

Description

Found while doing VAULT-30. Only codes copied by tapping go through Vault's Pasteboard, which applies Clear Clipboard, the Universal Clipboard setting and "concealed" marking. Other copies bypass it.

Copies that skip the settings:

  • Edit menu: text copied with the system edit menu goes straight to UIPasteboard.general. That covers:
    • note contents, both the plain SelectableText view and markdown's .textSelection(.enabled) in SecureNoteDetailView
    • a code's description
    • the backup key-deriver ID in BackupPasswordDetailsView
  • Widgets: WidgetPasteboard.copyOTP is always local-only, but it ignores Clear Clipboard.

Effect: these copies sync over Universal Clipboard whatever the settings say, and never expire. That goes against MANIFESTO.md C7.

What to change:

  • Route every copy through Pasteboard, or through the same policy, so it follows Clear Clipboard and Universal Clipboard and is marked concealed.
    • For UIKit text views, override copy(_:).
    • For SwiftUI selectable text, use a selectable view whose copy Vault controls. Rewriting the pasteboard after the fact isn't reliable for Universal Clipboard.
  • Give the widget copy the Clear Clipboard expiry.
  • Once note copies go through the policy, add a "Notes" toggle to the Universal Clipboard sheet from VAULT-30. Keep it off by default (C7).

Tests: unit tests that each copy path applies the policy, and snapshot tests of the sheet with the new toggle.

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/vault-app/pull/637 (merged as 5013f980).

Every copy from read-only text now goes through Vault's Pasteboard policy: the Clear Clipboard expiry, the Universal Clipboard setting and the concealed marking.

Plain notes and descriptions:

  • SelectableTextView overrides copy(_:), so the copy never reaches the pasteboard any other way.
  • Its menu offers only Copy and Select All. Share, Look Up, Translate, dragging and Writing Tools are off.
  • Descriptions can now have part of their text selected.

Formatted (Markdown) notes: MarkdownUI can't have a copy Vault controls. So touch and hold now offers Copy Note and Select Text. Select Text opens a half-height sheet where any part of the note can be selected.

Backup key ID: touch and hold for Copy ID.

Widget: Clear Clipboard moved to the App Group defaults, and an earlier choice is carried over, so widget copies now expire. They still never reach other devices.

Settings:

  • The Universal Clipboard sheet has a new Notes switch, off by default (C7).
  • Descriptions and other details are a separate .detail type that always stays on this device.
  • The row reads Off, On, "Codes Only" or "Notes Only".

Tests:

  • SelectableTextTests copies from each real view in a window.
  • PasteboardTests, LocalSettingsTests, WidgetPasteboardTests and ConcealedPasteboardTests.
  • New and re-recorded snapshots for the sheet, the Select Text sheet and Settings.

Follow-up in VAULT-64 (backlog):

  • Cut and Copy inside text fields being edited.
  • Dragging a code card out of the feed.