desktop icon indicating copy to clipboard operation
desktop copied to clipboard

macOS: TLS Client Certificate selection fails with "Could not access the selected certificate file"

Open Murgeye opened this issue 1 month ago • 1 comments

⚠️ Before submitting, please verify the following: ⚠️

Bug description

I have configured the reverse proxy (nginx/1.31.8) serving my Nextcloud server (Nextcloud 35.0.2) to require a client certificate. Theoretically, the desktop client (35.0.0) supports this, but on macOS (27.0.1) it seems to cause a permission issue, resulting in the error "Could not access the selected certificate file".

Image

Steps to reproduce

  1. Set up a Nextcloud server behind client auth (usually with a reverse proxy)
  2. Create a client certificate (.p12) for auth (optionally: test access with a browser to check setup)
  3. Set up Nextcloud on macOS, enter the server URL, and click Log in
  4. Click Use client certificate
  5. Click Choose and select the .p12 file created in step 2 from the file dialog.
  6. The error is shown.

Expected behavior

The .p12 file is imported.

Which files are affected by this bug

none

Operating system

macOS

Which version of the operating system you are running.

27.0.1

Installation method

Official Installer for macOS 13 and later

Nextcloud Server version

35.0.2

Nextcloud Desktop Client version

35.0.0

Did this occur after an update or on a clean installation?

Clean desktop client installation

Are you using the Nextcloud Server Encryption module?

No

Are you using an external user-backend?

  • [x] Default internal user-backend
  • [ ] LDAP or Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Nextcloud Server logs


Additional info

Root cause

Using Opus 5.5, I traced this to MacSandboxSecurityScopedAccess (src/common/macsandboxsecurityscopedaccess.mm), which converts a QUrl to a local path (line 35), then to an NSUrl (line 42), and checks its access scope (line 50). However, a fresh NSUrl created from a file path never carries a security scope, so the sandboxed app rejects every file.

Client log (redacted)

nc-redacted.log

Relevant line:

[ warning nextcloud.common.mac.sandbox /Volumes/builds/42361/macos-42361/src/common/macsandboxsecurityscopedaccess.mm:55 ]:	Failed to start accessing security-scoped resource: "/Users/<user>/mac.p12"

Fix/PR

I have a fix and will open a PR.

Murgeye avatar Oct 27 '26 14:10 Murgeye

Idem here, waiting the fix! Thanks Kall

Kalltech avatar Oct 28 '26 00:10 Kalltech