macOS consent shared by bundle identifier
按 Bundle ID 共用 macOS 应用授权
Users who install multiple versions of one application want one permission decision for that software. Executable paths split those decisions, and signing checks exclude unsigned development applications from saved access.
English
Problem
Users who install multiple versions of one application want one permission decision for that software. Executable paths split those decisions, and signing checks exclude unsigned development applications from saved access.
Decision
macOS application consent uses the exact, case-sensitive native bundle identifier. The helper hashes macos:bundle-id: followed by that identifier into CuaApplicationId. When a bundle identifier exists, installation paths, versions and signatures do not distinguish grants. Otherwise, the helper hashes macos:executable-path: followed by the canonical executable path. Both identities support saved access; path identities survive restart and in-place updates, while a different path requires a new decision. Conversation decisions and saved grants retain the scopes and revocation behavior of profile consent storage.
This supersedes the executable/signature identity choice in application consent; that note still owns enforcement and human decisions. The running executable path comes from the operating system: applications use the executable URL in their macOS application metadata, and processes without that metadata use the kernel process path. Applications such as Google Chrome can run from a temporary code-signing copy whose kernel path names the copy instead of the installed executable. A valid runtime bundle identifier does not depend on path-query success. Missing paths omit optional grant metadata; they never substitute a cached catalog path. When both the bundle identifier and the running executable path are unavailable, consent fails with the path query cause. Process identity must still be verified, and any available running executable path must match the selected target. Missing catalog path metadata does not block consent when the running executable path is available. If the runtime bundle identifier is unavailable, a reported application bundle can supply it only when its main executable matches the running executable path; otherwise that path identifies the grant. Native process, executable-location and window checks continue to bind each handle to its selected target. Launch checks reread the bundle identifier and executable path from disk; they do not fingerprint executable content. Replacing bytes at the same path while retaining the identifier or path identity therefore retains consent, including during an approval wait.
The identity prefixes separate new grants from old path/signature, process-instance and executable-content digests. Old grants remain removable but do not grant access to new bundle identities; users decide again before permission covers other installations.
Apple’s PPPC configuration supports bundle-ID or path selectors and separately requires a code-signing requirement. TN3127 explains that designated requirements track code identity across versions, while unsigned and ad-hoc code cannot provide the same stability. DSH adopts the selector alternatives for application management without requiring publisher authentication.
Alternatives considered
Bundle identifier and path. This distinguishes installed copies but requires separate decisions for the multiple versions the user wants to authorize together.
Bundle identifiers only. Missing identifiers would exclude otherwise usable applications from saved access. Canonical executable paths supply a stable fallback without using a PID or content hash.
Verified signing identity. This distinguishes publishers but denies saved access when signing is absent or cannot be verified. Publisher authentication is outside this application-management policy.
Consequences
Another program declaring the same bundle identifier or replacing an executable at its approved fallback path inherits consent, including a program created or changed through separately authorized model tools. Because application metadata supplies the running executable path, the selection check compares the executable that macOS registered for an application process, not the image the kernel runs: a process whose running image differs from that registration, such as an application still running after an in-place update, keeps the registered path and identity. The worst consequence is observing or controlling an application that the user did not approve separately, within its available data and capabilities. The model cannot supply the authorization identity through the CUA request; the native helper reads it from the selected application. Different bundle identifiers require different decisions, even when users consider them versions of one product.
Revocation applies to every installation sharing the identifier. Tests exercise unsigned copies, different identifiers, missing identifiers with persistent path consent, application metadata that differs from the kernel process path, process restarts, symlink aliases, pending and running identity agreement, shared handle revocation and refusal to widen old grants.
中文
问题
用户安装同一应用的多个版本时,希望对这个软件只做一次权限决定。可执行文件路径会拆分这些决定,签名检查也会让未签名的开发版应用无法保存长期授权。
决策
macOS 应用授权使用原生应用提供的、区分大小写的完整 Bundle ID。helper 将 macos:bundle-id: 和该标识连接后计算摘要,生成 CuaApplicationId。有 Bundle ID 时,安装路径、版本和签名不区分授权。否则,helper 对 macos:executable-path: 与规范化可执行路径计算摘要。两种身份都支持长期许可;路径身份在重启和原地更新后保持不变,另一个路径需要新的决定。会话决定和长期许可保留profile 授权存储规定的范围和撤销行为。
本决策取代应用授权中的可执行文件和签名身份选择,原记录仍负责执行检查与用户决定。运行中的可执行路径由操作系统提供:应用使用其 macOS 应用元数据中的可执行文件 URL,没有应用元数据的进程使用内核报告的进程路径。Google Chrome 等应用可能从临时代码签名副本运行,内核报告的路径指向该副本,而不是已安装的可执行文件。有效的运行时 Bundle ID 不依赖路径查询成功。无法取得路径时省略授权记录中的可选路径信息,不用缓存的应用目录路径代替。Bundle ID 和运行中的可执行路径均不可用时,授权失败并报告路径查询原因。进程身份仍须验证,可取得的运行中可执行路径仍须与所选目标一致。只要能取得运行中的可执行路径,应用目录信息中缺少路径不会阻止授权。运行时无法取得 Bundle ID 时,仅在其报告的应用 bundle 主可执行文件与运行中的可执行路径一致时读取该标识,否则按该路径识别授权。原生进程、可执行文件位置和窗口检查继续把每个句柄绑定到所选目标。启动检查从磁盘重新读取 Bundle ID 和可执行路径,但不计算可执行内容指纹。因此,在相同路径下替换内容且保留相同标识或路径身份时,许可仍会沿用,包括等待用户批准期间的替换。
身份前缀将新授权与旧的路径和签名、进程实例、可执行内容摘要分开。旧授权仍可撤销,但不能授予新 Bundle ID 身份访问权限;许可覆盖其他安装副本前,需要用户重新决定。
Apple 的 PPPC 配置支持 Bundle ID 或路径选择条件,同时另行要求代码签名条件。TN3127说明了指定要求如何跨版本识别代码,以及未签名和临时签名代码无法提供同等稳定性。DSH 采用这两种选择条件管理应用,不要求验证发布者身份。
考虑过的替代方案
Bundle ID 加路径。 可以区分安装副本,但用户希望共同授权的多个版本仍需分别确认。
仅使用 Bundle ID。 缺少标识会让本可操作的应用无法获得长期许可。规范化可执行路径提供稳定的后备标识,无须使用进程号或内容摘要。
验证签名身份。 可以区分发布者,但没有签名或验签失败时无法保存长期授权。发布者身份验证不属于本项应用管理规则。
后果
其他程序声明相同 Bundle ID,或替换路径授权对应的可执行文件时,会继承许可,包括通过其他已授权模型工具创建或修改的程序。由于运行中的可执行路径取自应用元数据,选择检查比较的是 macOS 为应用进程登记的可执行文件,而不是内核实际运行的映像:进程实际运行的映像与登记不一致时,例如原地更新后仍在运行的应用,仍沿用登记的路径和身份。最坏后果是在应用已有数据和能力范围内,读取或控制用户未单独批准的程序。模型不能在 CUA 请求中提交授权身份,该身份由原生 helper 从实际选中的应用读取。不同 Bundle ID 仍需分别授权,即使用户将它们视为同一产品的不同版本。
撤销作用于同一标识的所有安装副本。测试覆盖未签名副本、不同标识、缺少标识时的持久路径许可、应用元数据与内核进程路径不一致、进程重启、符号链接、启动前后身份一致、多个句柄共同撤销,以及不扩大旧授权。