Sandbox Permissions for Clipboard Monitoring and Modification in a macOS App

Hello,

I’m developing a sandboxed macOS app using Qt, which will be distributed via the Mac App Store. The app:

  • Monitors the clipboard to store copied items.
  • Overrides the paste function of the operating system via keyboard shortcuts.
  • Modifies clipboard content, replacing what the user pastes with stored data.

So, I have some questions:

  1. Can a sandboxed app continuously read and modify clipboard content?
  2. What entitlements are required?
  3. What permissions should I request from the user to ensure that my app works?

Any guidance would be greatly appreciated! Thanks in advance!

Beril Bayram

I’m developing a sandboxed macOS app using Qt, which will be distributed via the Mac App Store. The app:

Monitors the clipboard to store copied items.

Overrides the paste function of the operating system via keyboard shortcuts.

Modifies clipboard content, replacing what the user pastes with stored data.

Have you tested this? Your first statement suggests this is something in progress, for future release. Your other statements suggest these features are already functional. #1 and #3 are doable, albeit tricky trying to do both at the same time. I would be very surprised if you could do #2 from an app. That's something the user would have to do.

Can a sandboxed app continuously read and modify clipboard content?

Sure

What entitlements are required?

None

What permissions should I request from the user to ensure that my app works?

That's going to be tricky. It sounds like App Review might not like this. In my experience, they seem to want an app to be fully functional without asking the user for anything extra. By that I mean they consider the full functionality of an app to be that which it can do without asking for anything extra. They may not let you claim any of that extra stuff in your app's description or screenshots.

Of course, I'm making assumptions and ***** generalizations here. I'm not App Review and I can't speak for them. All I can do is relate my own experience, as well as imagine what I would do if I were working for App Review.

I can tell you that App Review doesn't pre-authorize anything. You have to develop it all, submit, and hope they approve.

You also have to think maliciously. Imagine yourself as a developer doing evil things. Could your app facilitate that activity? In other words, look at your app objectively, from App Review's perspective. Is this an app that would bring value to our customers? (i.e. They are Apple's customers, not yours.)

And I think you should also think of the value the app would bring to you as the developer. I used to have a similar app in the Mac App Store. I pulled it years ago and nobody misses it. There are lots and lots of other clipboard apps. What's that Qt code base going to do for you in the future?

Compare all of that to a more straightforward app, that doesn't deeply involve itself in any system services, written in SwiftUI, for iOS and all other Apple platforms. Just something to consider.

Etresoft’s response makes a lot of sense, but I want to put my own spin on this.

The way I look at this, it breaks down into two parts:

  • Is what you’re doing possible?

  • Will App Review accept it?

The second part is irrelevant if the answer to the first part in “No.” So, let’s break down that first part:

Monitors the clipboard to store copied items.

Currently this is eminently achievable on macOS.

However, I want to supply a word of warning here. A few years ago we added privacy controls to the pasteboard on iOS. It’s not hard to imagine this coming to macOS at some point. Now, macOS is a very different platform from iOS, and clipboard managers have a long and storied history on the Mac [1]. However, it’s definitely something to factor into your planning.

Overrides the paste function of the operating system via keyboard shortcuts.

macOS has a wide variety of mechanisms for intercepting keyboard events. Some of those are compatible with the App Sandbox. So, you should be able to get this working for command-V.

Getting this working for the Edit > Paste menu command would be harder. I’m not aware of any supported way to do that.

One thing to note thought: Don’t try to use the Accessibility API for this. It’s not available in sandboxed apps.

Modifies clipboard content, replacing what the user pastes with stored data.

That’s absolutely possible.


Regarding the second part, I don’t work for App Review and can’t offer definitive answers on their behalf.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Indeed, if Keyboard Maestro stopped working my DevForums productivity would plument (-;

Written by berilbayram in 772649021

How do you get those fancy quote blocks?

I can't even get blank lines to work properly when I'm trying to quote multiple blocks.

Hello again. Thank you for your replies.

Overrides the paste function of the operating system via keyboard shortcuts.

Sorry for the misunderstanding, what I was saying by overriding is that it provides an alternative keyboard shortcut for pasting text, which is manipulated by the app in some way.

Also, the app is QT-based since it is developed as a cross-platform app.

One thing to note thought: Don’t try to use the Accessibility API for this. It’s not available in sandboxed apps.

The functionality was implemented via the Accessibility API, but I'll try to find other solutions. If anyone has suggestions for other approaches, I'd be grateful to hear them.

Thanks in advance!

How do you get those fancy quote blocks?

Quoting a single block should work as expected. There’s an outstanding bug in the DevForums platform where quoting multiple blocks runs into problems (r. 129474377).

The solution is to remove the blank lines from the quote. For example, for the above the quote button yields this text:

[quote='821620022, Etresoft, /thread/772649?answerId=821620022#821620022, /profile/Etresoft']

How do you get those fancy quote blocks?

[/quote]

That works for a single quote but triggers a failure for multiple quotes. To fix that, remove the blanks lines from each quote. So, instead of the above, use this:

[quote='821620022, Etresoft, /thread/772649?answerId=821620022#821620022, /profile/Etresoft']
How do you get those fancy quote blocks?
[/quote]

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sandbox Permissions for Clipboard Monitoring and Modification in a macOS App
 
 
Q