为什么 bash 脚本 运行 直接不需要用户权限,但 .app 文件 运行 脚本需要用户权限?

Why a bash script ran directly doesn't need user permissions, but a .app file running the script needs them?

我有一个 bash 脚本 myscript 加载一些 applescript 来提示用户图形界面,询问他的密码。

是否有 link 解释 .app 安全性对于执行脚本与命令行的不同之处?

在这两种情况下,脚本都是由应用程序启动的。在一种情况下,该应用程序是终端,并且它具有所需的权限。您的应用目前没有。

这是 10.14 中的更改,在 release notes:

中有描述

Sending Apple events from an app—including script applets—now requires user approval. The list of currently approved apps can be viewed and edited in the Automation category in the Privacy tab in System Preferences > Security & Privacy. If an event is blocked because the user didn’t approve that app, the event will fail with the error code: -1743 (": Not authorized to send Apple events to "). An event can be preflighted using AEDeterminePermissionToAutomateTarget(::::).

Mojave 对 Apple Events(AppleScript 的核心)引入了非常严格的控制,自动化非常复杂。 Michael Tsai has aggregated a lot of helpful discussion of the issues.

另请参阅: