Shortcuts Shell Script cannot access User's folders when execute via Quick Action
As mentioned in the title, macOS' Shortcuts' Shell Script fails to access the user's folders (e.g. Downloads, Desktop, Documents, etc.) on any commands (e.g. ls, md5) when executed via Quick Action (i.e. right click on any file in the Finder, then select "Quick Action" to run the shortcut in the menu).
I found this problem after I updated to macOS 14. I have a script that may access those folders, it worked fine on macOS 13, but cannot run properly on macOS 14 (only if the shell command accesses the user's folders).
Here below is the simplest shortcut script that can reproduce the problem.
This script can run properly if we run it directly from the Shortcuts app. But if we run it via Quick Action (as checked on the rightmost column), it will produce the following error message:
Run Shell Script finished with an error.
ls: /Users/gordon/Desktop: Operation not permitted
I have tried to check the "Privacy & Security" setting, and grant "Full Disk Access" to the Shortcuts app. But the problem still exists.
I have also tried to add 'sudo' before the command', or try some other shells other than zsh. But it still doesn't work.
MacBook Pro 14″, macOS 14.0