Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

macOS: file-access permission not persisted on save (release is ad-hoc signed / not notarized)

Open PathGao opened this issue 4 months ago • 11 comments

Describe the bug

On macOS, Markpad repeatedly asks for file-access permission every time it saves a file into a protected folder (Desktop / Documents / Downloads), even after the user has explicitly allowed access in System Settings and even after granting Full Disk Access to the app. The grant never "sticks" — the prompt returns on the next save.

Opening files does not trigger the prompt (the macOS Open panel / Powerbox implicitly grants access to the user-selected file). The problem is specific to the write/save path.

Likely root cause

The distributed macOS app is ad-hoc signed and not notarized, so macOS cannot pin a TCC / Full Disk Access grant to a stable code-signing identity, and re-prompts on each protected-folder write. Evidence from the installed app (/Applications/Markpad.app):

$ spctl -a -vvv /Applications/Markpad.app
/Applications/Markpad.app: rejected
source=no usable signature

$ codesign -dvv /Applications/Markpad.app
Identifier=Markpad-60fe2234e2ef4c98
Signature=adhoc
TeamIdentifier=not set

# no sandbox / files entitlements
$ codesign -d --entitlements :- /Applications/Markpad.app   # (empty)

Because the signature is ad-hoc (no Developer ID, unstable auto-generated identifier), TCC treats the grant as untrusted / non-persistent. Granting Full Disk Access does not resolve it.

This was verified on the official v2.6.11 release (downloaded via browser, not a local build) — the app still carries its download quarantine attribute:

$ xattr -l /Applications/Markpad.app
com.apple.quarantine: 03c1;........;Chrome;........
# CFBundleShortVersionString = 2.6.11, binary dated Jun 2026

To Reproduce

  1. On macOS, open a Markdown file located on the Desktop (or in Documents/Downloads).
  2. Edit it and save (⌘S) back to the same location.
  3. macOS shows a "Markpad wants to access files in your Desktop folder" prompt. Click Allow.
  4. Grant Markpad Full Disk Access in System Settings → Privacy & Security.
  5. Edit and save again — the permission prompt still appears. The grant is not remembered.

Expected behavior

After allowing access once (or after granting Full Disk Access), saving to Desktop / Documents / Downloads should not prompt again. The grant should persist across saves and app launches.

Suggested fix

Sign the macOS release with a Developer ID Application certificate and notarize it (staple the ticket). TCC / Full Disk Access grants are keyed to a stable code-signing identity; a Developer-ID signature gives macOS a stable identity to persist the grant against. An ad-hoc signature does not.

This was confirmed on the official downloaded v2.6.11 release (not a local build), which spctl reports as having no usable signature.

Device

  • OS: macOS (Darwin 25.5.0)
  • App Version: v2.6.11 (official release, downloaded)

Additional context

The app is not sandboxed, so file access to Desktop/Documents/Downloads is governed by TCC folder permissions rather than security-scoped bookmarks. Saving is a direct filesystem write to the target path, which is what triggers the TCC check on every write when the signing identity is not trusted/persistent.

PathGao avatar Jul 12 '26 13:07 PathGao

Confirmed again on the official v2.6.14 bundle: Signature=adhoc, TeamIdentifier=not set, and spctl reports source=no usable signature. The repeated folder-access prompts are therefore not fixable by Full Disk Access alone; macOS cannot bind a persistent TCC grant to this release identity.

PR #294 adds Developer ID signing + notarization support to the release workflow and documents the required repository secrets. Once those secrets are configured and the PR is merged, the next signed/notarized release can resolve the root cause.

PathGao avatar Jul 31 '26 05:07 PathGao

Reframing this as a release prerequisite rather than a code PR: the current v2.6.14 bundle is ad-hoc signed, so macOS cannot retain its TCC folder grant. Full Disk Access cannot correct that identity problem.

To resolve it for a future release, a repository owner needs to:

  1. Enroll the releasing organization in the Apple Developer Program.
  2. Create a Developer ID Application certificate, export it as a password-protected .p12, and store its base64 value plus its password as GitHub Actions secrets.
  3. Add notarization credentials: either an App Store Connect API key or an Apple ID app-specific password with the team ID.
  4. Build, notarize, staple, and verify the DMG/app with spctl -a -vvv before publishing.

Tauri’s official guide covers the required certificate and notarization variables: https://v2.tauri.app/distribute/sign/macos/

Until that is available, the practical workaround is to disable Auto-save (or enable Confirm before save) for documents in Desktop, Documents, or Downloads. Each automatic write can otherwise trigger another system prompt.

The CI proposal in #294 was closed because the required credentials are not currently available; a strict workflow gate would block all releases without solving that prerequisite.

PathGao avatar Jul 31 '26 05:07 PathGao

@PathGao I believe a Apple Dev Program fee runs about $100/yr. I'll check our macos userbase and look into applying tomorrow. thanks for bringing this to my attention, as a windows dev I've yet to test on a mac

alecdotdev avatar Aug 02 '26 04:08 alecdotdev

@alecdotdev Don't worry — there's no need to take on the Apple Developer Program cost purely for cross-platform development.

I used to be an Apple Developer, but I have not renewed my membership recently. I may renew it later; if signing and notarization are still needed then, we can revisit whether my Apple Developer ID can be used for the release process.

PathGao avatar Aug 02 '26 05:08 PathGao

No change here — recording the current state so it isn't rediscovered.

tauri.conf.json still has "signingIdentity": null and "entitlements": null, and the release workflow has no notarization step, so macOS builds remain ad-hoc signed. Persisted file-access permission requires a stable code signature, so this can't be fixed in application code — it needs a Developer ID certificate and a notarization step in CI, which is a maintainer decision.

PathGao avatar Aug 02 '26 21:08 PathGao

Temporary work around for this annoyance is to sign the app locally yourself through the following steps:

Create a certificate (only needs to be done once)

  1. Open the Keychain Access app on your Mac.
  2. From the top menu bar, select Keychain Access > Certificate Assistant > Create a Certificate Authority.
  3. Name the certificate, set the Identity Type to Code Signing, and check Let me override defaults.Finish the wizard and ensure the 4. certificate is set to trusted on your local system.

Sign using one of the following methods (must be repeated after every update):

a. Open your terminal and run the local signing command:codesign --force --deep -s "YourCertificateName" /path/to/YourApp.app -or- b. Use the Sentinel app at https://github.com/alienator88/Sentinel

nashv avatar Aug 08 '26 11:08 nashv

Temporary work around for this annoyance is to sign the app locally yourself through the following steps:

Create a certificate (only needs to be done once)

  1. Open the Keychain Access app on your Mac.
  2. From the top menu bar, select Keychain Access > Certificate Assistant > Create a Certificate Authority.
  3. Name the certificate, set the Identity Type to Code Signing, and check Let me override defaults.Finish the wizard and ensure the 4. certificate is set to trusted on your local system.

Sign using one of the following methods (must be repeated after every update):

a. Open your terminal and run the local signing command:codesign --force --deep -s "YourCertificateName" /path/to/YourApp.app -or- b. Use the Sentinel app at https://github.com/alienator88/Sentinel

Thank you so much!Trying it now.

PathGao avatar Aug 08 '26 11:08 PathGao

A concrete alternative to the $100/yr question — the permission half of this issue is fixable for free.

Prior art: AeroSpace (i3-like WM for macOS, needs an Accessibility grant, so it has exactly this TCC identity problem). It ships signed with a self-created keychain certificate, not a Developer ID, and is not notarized:

  • build-release.sh: codesign_identity="aerospace-codesign-certificate"
  • Homebrew cask postflight: xattr -d com.apple.quarantine ...
  • README: "By using AeroSpace, you acknowledge that it's not notarized. […] I don't have anything against notarization as a concept. I specifically don't like the way Apple does notarization."

Why that is enough here. TCC binds a grant to the app's designated requirement, not to the binary. Measured locally:

ad-hoc (what Markpad ships today)
  designated => cdhash H"72f23bf3…"
  same source, one line changed, re-signed:
  designated => cdhash H"17c9b0c8…"      <- a different app, as far as TCC is concerned

self-signed certificate (two different binaries, one certificate)
  designated => identifier <bundle-id> and certificate leaf = H"abfa8c3e…"
  designated => identifier <bundle-id> and certificate leaf = H"abfa8c3e…"
                                                              ^ unchanged across builds

The grant survives updates as long as the certificate stays the same. The certificate does not even need to be trusted on the build machine — I confirmed signing succeeds with the trust dialog cancelled.

Correcting my earlier comment in this thread: I wrote that Developer ID + notarization is the only real fix. That holds for the Gatekeeper half only. The permission-persistence half — which is what this issue is actually about — is fixable with a free self-signed certificate.

What it would take, with no application code:

  1. src-tauri/tauri.conf.json: "signingIdentity" from null to the certificate's common name.
  2. Release workflow: import a password-protected .p12 into a temporary keychain (same shape as the existing TAURI_SIGNING_PRIVATE_KEY secrets); Tauri signs the bundle from there.

What it does not fix. The app stays un-notarized, so a DMG downloaded from Releases still shows the Gatekeeper warning on first launch. AeroSpace hides that with its cask postflight, and Markpad has no Homebrew cask (#102), so that half does not carry over. That is the status quo either way — ad-hoc bundles already fail spctl. Nothing gets worse.

Trade-offs worth naming before anyone commits:

  • The .p12 becomes a long-lived key with no revocation path. If it leaks, someone can sign a fake Markpad that inherits every folder grant users already gave the real one. Apple can revoke a Developer ID certificate; nobody can revoke this one.
  • Rotating or losing the certificate means every user re-grants from scratch. Operationally it sits at the same level as the minisign updater key.

@nashv — this is your workaround moved to the release side: same certificate mechanism, except signing once in CI means users would no longer have to re-run codesign after every update. Apologies for going quiet after "Trying it now".

@alecdotdev — your call on whether the no-revocation trade-off is acceptable. If it is not, the status quo is fine and this can stay parked. I mainly wanted the free option on the record, rather than leaving "$100/yr or nothing" as the framing.

PathGao avatar Aug 22 '26 19:08 PathGao

One practical note on who holds the certificate: I can create it and keep the .p12 if that unblocks you — I have a Mac and can hand over the base64 plus the password for the Actions secrets.

That said, you holding it is the better arrangement. The certificate is the release identity, so it should sit in the same hands as the release process. If it lives with me, every rotation, expiry, or machine change needs me to be around, and that is a dependency the project does not need. Creating it is a five-minute one-time job in Keychain Access (Certificate Assistant > Create a Certificate, Identity Type: Code Signing), and no Apple account is involved.

Happy to write the workflow changes either way.

PathGao avatar Aug 22 '26 19:08 PathGao

Opened #707 for this. It is inert until the three secrets exist — without MACOS_CERTIFICATE the step prints one line and exits, so it can sit merged without changing a single byte of a release.

On timing: we have landed a batch since the last release (#685–#705 — Markdown colouring from the renderer, editor/preview swap, the save-conflict and Live Mode fixes, CJK word count, cold-start focus), and the repo is at 926 stars. It might be worth holding these for the 1k mark and shipping them as one release rather than cutting something now — and if the certificate is set up by then, the macOS permission fix rides along. A "1000 stars" release reads better with that batch behind it than any of those items do on their own.

Not urgent either way: #707 blocks nothing, and the release can go whenever suits you.

PathGao avatar Aug 22 '26 19:08 PathGao

Starting with the next release, the macOS app is signed with an Apple Developer ID and notarized (#786). It opens without the Gatekeeper warning, and folder access carries across updates. You will be asked for folder access one more time after updating to it, because the signing identity changes. #793 removes the old workaround notes from the release page. I'll close this once that release is out.

PathGao avatar Sep 17 '26 17:09 PathGao