Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure osxphotos is responsible process by launching disclaimed #1587

Merged

Conversation

torarnv
Copy link
Contributor

@torarnv torarnv commented Jun 19, 2024

When osxphotos accesses the Photos library the macOS TCC system will check the responsible process for permission to access the library, and if none has been given, the user is asked to give permission via a dialog.

Normally, when an executable is launched from Terminal or iTerm, the responsible app is the terminal app itself, not osxphotos, which means the user needs to give the terminal app the permission to access the Photos library, effectively giving any command executed in the terminal at any point access to the library.

Worse yet, if the user has on some prior occasion denied the terminal app this access, then osxphotos will not get the needed access either, which has been a source for confusion and failures for users.

We now re-launch osxphotos at startup with a special spawn flag that ensures that osxphotos is the responsible process. This will result in TCC dialogs and permissions specific to osxphotos.

When osxphotos accesses the Photos library the macOS TCC system
will check the responsible process for permission to access the
library, and if none has been given, the user is asked to give
permission via a dialog.

Normally, when an executable is launched from Terminal or iTerm,
the responsible app is the terminal app itself, not osxphotos,
which means the user needs to give the terminal app the permission
to access the Photos library, effectively giving any command
executed in the terminal at any point access to the library.

Worse yet, if the user has on some prior occasion denied the
terminal app this access, then osxphotos will not get the needed
access either, which has been a source for confusion and failures
for users.

We now re-launch osxphotos at startup with a special spawn flag
that ensures that osxphotos is the responsible process. This will
result in TCC dialogs and permissions specific to osxphotos.
@torarnv
Copy link
Contributor Author

torarnv commented Jun 19, 2024

Still checking a few things, so please don't merge just yet, thanks 😊

@torarnv
Copy link
Contributor Author

torarnv commented Jun 19, 2024

One thing this revealed that osxphotos also requests permission to other apps, as part of resolving the default photo library, and last used photo library:

image

I think we might be able to check the last-modified-date of the individual photo libraries without reading any files in them to determine the latter, but I've not yet found a way to determine the default library without access to Photo's container.

@torarnv
Copy link
Contributor Author

torarnv commented Jun 19, 2024

For reference, this is how the Photos access is presented:

image

image

@torarnv
Copy link
Contributor Author

torarnv commented Jun 20, 2024

Still checking a few things, so please don't merge just yet, thanks 😊

All good, just wanted to confirm that signing worked.

@RhetTbull RhetTbull merged commit 39f16e4 into RhetTbull:main Jun 22, 2024
7 checks passed
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.

2 participants