Skip to content

fix: mark macOS clipboard copies as transient#70

Open
banteg wants to merge 2 commits into
FiloSottile:mainfrom
banteg:hardening/macos-concealed-clipboard
Open

fix: mark macOS clipboard copies as transient#70
banteg wants to merge 2 commits into
FiloSottile:mainfrom
banteg:hardening/macos-concealed-clipboard

Conversation

@banteg
Copy link
Copy Markdown

@banteg banteg commented May 7, 2026

Summary

  • write macOS clipboard copies with org.nspasteboard.ConcealedType, org.nspasteboard.TransientType, and org.nspasteboard.AutoGeneratedType
  • use printf instead of echo -n when piping copied password data
  • avoid re-copying clipboard contents if the user changes the clipboard before the timeout expires
  • restore the previous clipboard contents through the same marked pasteboard path when the password is still present
  • fall back to pbcopy if osascript is unavailable

Motivation

Clipboard managers such as Raycast treat concealed/transient pasteboard items as sensitive and skip recording them in clipboard history. This matches the direction of #69 for Wayland wl-copy --sensitive, but applies to the Darwin platform helper.

The changed-timeout behavior also avoids creating a new clipboard-history event for content the user copied after passage --clip ran.

Testing

On macOS, sourced src/platform/darwin.sh and called clip with dummy values:

  • verified the copied dummy value remains pasteable via pbpaste
  • verified pasteboard types include org.nspasteboard.ConcealedType, org.nspasteboard.TransientType, and org.nspasteboard.AutoGeneratedType
  • verified the timeout path restores the previous dummy clipboard value when the password is still present
  • verified the timeout path leaves a user-changed dummy clipboard value untouched
  • ran bash -n src/platform/darwin.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant