Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

Your clipboard manager can see your passwords. What a Mac app should do about it

Copy a password from your password manager, then open your clipboard history. If the password is sitting there in plain text, your clipboard tool is ignoring a convention that has existed on the Mac for years. I build a

Copy a password from your password manager, then open your clipboard history. If the password is sitting there in plain text, your clipboard tool is ignoring a convention that has existed on the Mac for years.

I build a clipboard manager, which means my app reads every single thing you copy. That's the whole feature. It's also why I spent more time on what it refuses to save than on what it saves. Below is how mine handles it, with the Swift code.

How a Mac app sees your clipboard

macOS has no "clipboard changed" notification. Every clipboard manager does the same thing: it polls NSPasteboard.general.changeCount on a timer and reads the pasteboard when the number goes up.

import AppKit

final class ClipboardWatcher {
    private var lastChange = NSPasteboard.general.changeCount
    private var timer: Timer?

    func start(onChange: @escaping (NSPasteboard) -> Void) {
        timer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { [weak self] _ in
            guard let self else { return }
            let pb = NSPasteboard.general
            guard pb.changeCount != self.lastChange else { return }
            self.lastChange = pb.changeCount
            onChange(pb)
        }
    }
}

Notice there's no permission prompt anywhere in that code. For years, any Mac app could do this silently. iPhones have shown a banner when an app reads the clipboard since iOS 14 in 2020. In May 2025, Apple told Mac developers that similar alerts are coming to macOS, and added APIs that let an app check what kind of data is on the pasteboard without reading it (see NSPasteboard's accessBehavior). An Apple engineer said they'd found Mac apps scraping the pasteboard continuously in the background.

So the clipboard is less private than most people assume. A clipboard manager makes that worse unless it's careful.

The markers password managers set

There's a community convention, documented at nspasteboard.org, for apps to label what they put on the pasteboard. When a password manager copies a password, it can add an extra pasteboard type that carries no data, only a meaning:

Type Meaning
org.nspasteboard.ConcealedType Sensitive. Don't save or show it.
org.nspasteboard.TransientType Temporary. Don't save it.
org.nspasteboard.AutoGeneratedType Put there by an app, not the user.

Checking for them takes a few lines:

extension NSPasteboard.PasteboardType {
    static let concealed     = Self("org.nspasteboard.ConcealedType")
    static let transient     = Self("org.nspasteboard.TransientType")
    static let autoGenerated = Self("org.nspasteboard.AutoGeneratedType")
}

func shouldSave(_ pasteboard: NSPasteboard) -> Bool {
    let types = Set(pasteboard.types ?? [])
    let skip: Set<NSPasteboard.PasteboardType> = [.concealed, .transient, .autoGenerated]
    return types.isDisjoint(with: skip)
}

Call shouldSave before you read a single byte of content. If it returns false, don't read the string, don't log it, don't keep it in memory "just for a second".

If you write an app that puts secrets on the pasteboard, set the marker yourself:

let pb = NSPasteboard.general
pb.clearContents()
pb.setString(secret, forType: .string)
pb.setData(Data(), forType: .concealed)

Hide the history from screen sharing

The second leak is visual. You open your clipboard history on a Zoom call, and everyone sees the last 20 things you copied.

You can ask macOS to leave a window out of screenshots and screen sharing:

historyWindow.sharingType = .none

Test this on the macOS versions you support, with the recorders your users actually use. Developers have reported that newer screen capture APIs don't always honor it, so don't promise more than you've checked.

Keep it local

The safest clipboard history is one that never leaves the Mac. No account, no sync, no analytics. If you add sync, it needs end-to-end encryption and an obvious off switch, because a synced clipboard is a synced list of everything the user copied.

What to check in any clipboard tool

Whether you build one or just use one:

  1. Copy a password from your password manager. It should not appear in the history.
  2. Share your screen and open the history. It should not show up on the other end.
  3. Look for a setting that excludes specific apps (password managers, banking apps).
  4. Check where the history is stored and whether anything goes over the network.
  5. If you're on macOS Tahoe, the built-in Spotlight clipboard (⌘Space, then ⌘4) is off by default. Since 26.1 you can choose how long it keeps items, and clear it from System Settings → Spotlight.

Disclosure

I make Makitro, a Mac menu-bar app whose clipboard history (⌃⌘V) works the way this post describes: it checks the nspasteboard.org markers before saving, hides from screen sharing, and keeps everything on your Mac. Every tool is free for 14 days, then it's a one-time licence. https://makitro.mdali.dev/

Does your clipboard tool pass the password test?

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.