macOS keychain ACL 如何确定哪些应用程序具有访问权限?

How does macOS keychain ACL determine which apps have access?

当应用程序将项目保存到钥匙串时,macOS 会将该应用程序添加到访问控制列表,以便您的应用程序稍后可以访问它。如果您尝试从其他应用程序访问该项目,macOS 将显示系统提示,询问用户是否允许访问。这已记录在案 here

App Name wants to use your confidential information stored in "com.company.appname.key" in your keychain. To allow this, enter the "login" keychain password.

macOS 如何知道哪些应用程序具有访问权限?是通过捆绑 ID、签名证书、应用程序在磁盘上的位置,还是其他?

在我们的应用程序中,当我们尝试访问一个我们只知道我们的应用程序创建的条目时,我们意外地看到了这个提示,所以我想弄清楚为什么 macOS 认为它是一个不同的应用程序。当我在 Keychain Access 中查看该项目时,它显示我们的应用程序名称列在 "Always allow access by these applications" 下的访问控制中,但该图标是一个通用文件,让我相信它认为该应用程序的新版本不是同一个应用程序。请注意,我不再安装旧版本。

你可以看看code signing documentation.

具体来说,"Shipping and Updating Your Product" 部分有这样的话(强调我的):

When you have qualified a new version of your product, sign it just as you signed the previous version, with the same identifier and the same designated requirement. The user’s system considers the new version of your product to be the same program as the previous version. For example, Keychain Services does not distinguish older and newer versions of your program as long as both are signed and the unique Identifier remains constant.