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

Osx 12.1 app always asks for permission to access Documents #5194

Open
schlosrat opened this issue Dec 16, 2021 · 18 comments
Open

Osx 12.1 app always asks for permission to access Documents #5194

schlosrat opened this issue Dec 16, 2021 · 18 comments
Labels
C: Port-specific Classification: Port-specific
Milestone

Comments

@schlosrat
Copy link

In the latest release (4.23-172-g6cad8b535), and at least recent builds such as 4.2.3-158-ga262294bd, the app always asks for permission to access the Documents folder. It does this persistently - no matter how many times you authorize permission it will ask again each time it opens or saves a file.

When saving a game you may get the dialog requesting permission to access the Documents folder several times - once for each file it reads or writes. This takes place regardless of if you've got the app authorized for file and folder access via the System Preferences > Security & Privacy > Privacy > Files and Folders setting where the app shows for the OS as already having permission set correctly.

@backwardsEric
Copy link
Contributor

The last time this happened, #4974 , it appeared to be a corruption of some sort in the state macOS uses to determine whether a permissions prompt is triggered for an application. Apple has a command-line utility, tccutil, that's preinstalled. It may be useful to work around the problem you see. If you close Angband, if it's already running, and then run the following in a Terminal window (bring one up by Go->Utilities in the Finder menu and then double click on Terminal in the finder window that appears),

tccutil reset All org.rephial.angband
tccutil reset SystemPolicyDocumentsFolder org.rephial.angband

, do you still get the problem with repeated prompts to access Documents when you rerun Angband?

@backwardsEric backwardsEric added the C: Port-specific Classification: Port-specific label Dec 16, 2021
@backwardsEric backwardsEric added this to the Triage milestone Dec 16, 2021
@schlosrat
Copy link
Author

The last time this happened, #4974 , it appeared to be a corruption of some sort in the state macOS uses to determine whether a permissions prompt is triggered for an application. Apple has a command-line utility, tccutil, that's preinstalled. It may be useful to work around the problem you see. If you close Angband, if it's already running, and then run the following in a Terminal window (bring one up by Go->Utilities in the Finder menu and then double click on Terminal in the finder window that appears),

tccutil reset All org.rephial.angband
tccutil reset SystemPolicyDocumentsFolder org.rephial.angband

, do you still get the problem with repeated prompts to access Documents when you rerun Angband?

Thanks! That does seem to have fixed it.

@schlosrat
Copy link
Author

schlosrat commented Dec 17, 2021

I spoke too soon. While the fix above does fix things, it was only a temporary fix and now it's back to the same old tricks. In fact, it's even worse now. With angband not running and a fresh terminal window up I can run those two commands, which report being successful, however when I start angband it's asking for permission with each file access - no reprieve whatsoever.

Confused.

@jl8e
Copy link

jl8e commented Dec 17, 2021

I did some digging, and the problem is probably a combination of new permissions in recent os versions and the fact that the app isn't signed

@backwardsEric
Copy link
Contributor

Then an easy solution, for the development team at least, is to stop shipping a macOS binary and let players compile it for themselves.

To get a Developer ID for signing an application distributed outside of the AppStore requires membership in Apple's Developer Program (from https://help.apple.com/xcode/mac/current/#/dev520c0324f ,

"A Developer ID certificate is a type of distribution certificate you use to distribute your app outside the Mac App Store. Signing your macOS apps, plug-ins, and installer packages with a Developer ID certificate lets Gatekeeper verify that apps are not created by malware developers and haven't been tampered with since they were signed. Signed apps will launch on macOS when Gatekeeper is enabled. Developer ID certificates are issued only to members of the Apple Developer Program or Apple Developer Enterprise Program.")

The requirements (see https://developer.apple.com/programs/enroll/ ) for enrolling as an organization in Apple's Developer Program look like they'd be hard to meet for Angband. Using one individual's Developer Program access would be easier, but these problems come to mind:

  1. Handling continuity when that individual stops participating in Angband development won't be seamless. The application before and after will look it's coming from a different developer. On the backend, the development team probably has to change the bundle identifier in Info.plist, find someone else to get an individual developer program membership, and switch to using that person's signing certificate.
  2. Using (abusing) an individual's signing certificate for a group project seems problematic to me. That person's signing certificate has to be available on the system building the releases (that's currently GitHub's Actions infrastructure). With the way things are currently set up (i.e. approving a pull request automatically generates a new binary for release), a signed release could happen without any action on the part of the supposed signer.
  3. We'd need to verify that this sort of use is consistent with Apple's terms for the individual developer program.

@NickMcConnell
Copy link
Member

I have just updated to 12.1 in order to check this, and have no problem. Ironically, in 12.0 I was prompted for access to ~/Documents, but only on opening the game.

@NickMcConnell
Copy link
Member

As this seems machine-dependent and not fixable by Angband, should it be closed?

@schlosrat
Copy link
Author

I've found that by compiling locally I can avoid this for a time, but if I Force Quit out of the app it tends to get back to doing this. I've not tested it enough to be sure that's the issue, but it's my hunch. Curiously, it's now an intermittent problem regardless if I've recently compiled a fresh copy or recently done a force quit of the app.

@backwardsEric
Copy link
Contributor

A bit off-topic for the discussion here, but why are you finding it necessary to frequently use Force Quit on Angband? Is it just a case of shutting the system down while Angband's running or are you encountering instances where it doesn't respond to user input?

@schlosrat
Copy link
Author

schlosrat commented Dec 21, 2021

Neither of those. After years away I'm re-learning the game and figuring out strategies for various situations. I will save the game at what I think of as a decision point prior to engaging a foe I've not learned how to deal with or where I want to try out a strategy. If the engagement goes poorly I force quit and restart from my save point to try something different. This is cheating, I know, but it's also how I like to try out things and enjoy the game. I'm not posting to the ladder with this technique - in fact, I've never posted to the ladder.

If my force quitting the app is the cause of the problems I've seen, then I've brought them on myself and this may not be something that needs fixing at all. It's curious though that even with recompiling the app I sometimes see this issue and sometimes don't. If others aren't seeing it with OSX 12 then it's probably my own fault for force quitting like I've been doing.

@backwardsEric
Copy link
Contributor

My experience, both with macOS 11 and macOS 12 (the latter sparingly and only in a virtual machine), is like Nick's, I may get one prompt for accessing Documents after installing a new version or recompiling, but that's it.

The link posted by j8le above and the WWDC sessions that iare mentioned in it suggest that Apple is planning to require code signing for applications at some point.

@jl8e
Copy link

jl8e commented Dec 22, 2021

I mean, they basically already do; the hoops required to run an unsigned application are non-trivial.

It seems unlikely that they'll ever fully require it, but it'd be a worthwhile thing to figure out how to get Angband signed.

@NickMcConnell NickMcConnell modified the milestones: Triage, Annoying Dec 30, 2021
@NickMcConnell
Copy link
Member

If this doesn't qualify as Annoying, I don't know what does.

@AndyXuma
Copy link

AndyXuma commented Jan 21, 2022

To chip in on this issue –
New player (and new Mac user) here. I played the “official” 4.2.3 Release after updating my Mac to Monterey 12.1, and never got this issue.
I started having the problem after downloading some of the newer releases this year. It does happen to me on the current Release 4.2.3-249.
The number of permissions that I need to give varies, but I need to allow access files in the Documents folder at least once upon starting Angband. After that, it varies but usually the OS asks for permission once when opening a savegame file, and five times when saving. After that, no more permissions are needed until the next run.
What could be helpful in tracking down this issue is that on Monterey 12.1, if I revert to the original Angband 4.2.3 release, the problem stops. It happens only with the newer releases.

backwardsEric added a commit to backwardsEric/angband that referenced this issue Jan 21, 2022
…Info.plist since it matches the format Apple expects. The version from version.sh will still be used as the in-game version and for the package name. May help mitigate angband#5194 .
NickMcConnell pushed a commit that referenced this issue Feb 14, 2022
…Info.plist since it matches the format Apple expects. The version from version.sh will still be used as the in-game version and for the package name. May help mitigate #5194 .
NickMcConnell pushed a commit to NickMcConnell/FAangband that referenced this issue Feb 14, 2022
…Info.plist since it matches the format Apple expects. The version from version.sh will still be used as the in-game version and for the package name. May help mitigate angband/angband#5194 .
NickMcConnell pushed a commit to NickMcConnell/Beleriand that referenced this issue Feb 14, 2022
…Info.plist since it matches the format Apple expects. The version from version.sh will still be used as the in-game version and for the package name. May help mitigate angband/angband#5194 .
@stevelinberg
Copy link

Any news on this? It started happening for me on 4.2.4 when I migrated to a new M1 machine. None of the fixes here worked, including deleting, reinstalling, resetting everything, etc. It will ask for permissions when opening, saving, going up or down stairs (3 or 4 times in a row), dying, etc. Tried the most recent nightly, same results.

@backwardsEric
Copy link
Contributor

There was a change to the version information included in the Info.plist file a bit before the 4.2.4 release. That was in response to AndyXuna's post above and, if it did have an impact on this issue, would have only helped the nightly releases (which, without change, had version information that didn't fit the format expected by Apple). In your attempts to workaround the problem, did you try the tccutil commands mentioned above?

@stevelinberg
Copy link

stevelinberg commented Apr 8, 2022 via email

@backwardsEric
Copy link
Contributor

Since we don't have a signed executable, the only other workaround that is likely to work is to compile from source yourself. Instructions for how to do that is here, https://angband.readthedocs.io/en/latest/hacking/compiling.html#macos (those instructions assume you have Xcode and its command line compilers installed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Port-specific Classification: Port-specific
Projects
None yet
Development

No branches or pull requests

6 participants