r/shortcuts • u/Apprehensive_Tea1579 • 3d ago
Request (Mac) macOS Quick Action Shortcut for Encrypted ZIP (Passing Password + Folder Path to Shell Script without sandbox errors)
Hi everyone,
I'm trying to build a macOS Quick Action (Schnellaktion) using the built-in Shortcuts app to compress a folder into an encrypted ZIP file via a right-click.
My Goal:
- Right-click any folder in Finder (mostly in the Downloads folder).
- Select the Quick Action.
- A pop-up asks for a password (secure input).
- The folder gets zipped and encrypted using
zip -erand the output.zipfile is created directly in the same parent directory next to the original folder.
2
Upvotes
1
u/EquivalentSky3094 2d ago
The
zip -erroute cannot work from a Quick Action, and it is not a sandbox problem. From zip's own man page,-etakes a password "entered on the terminal in response to a prompt", and "if standard error is not a tty, zip will exit with an error". Run Shell Script inside Shortcuts has no tty, so zip bails before it ever looks at your folder.The only way to hand zip a password non-interactively is
-P password, and the man page shouts "THIS IS INSECURE!" about it in capitals, because any other user or process can read your command line. The same page also calls the standard zip cipher "relatively weak". Info-ZIP has no AES at all, so if you want AES-256 inside a .zip you need 7-Zip (7zz), which has the same password-in-argv problem unless you let it prompt.If you only need the contents encrypted and the .zip format itself is not a requirement, an encrypted disk image is a far stronger target and will take a password on stdin.
One thing worth fixing whichever route you take:
cd "$(dirname "$1")"first, then zip usingbasename "$1". Otherwise the archive stores your whole/Users/you/Downloads/...path inside it, and the output lands wherever Shortcuts happened to be. Thecdfixes both at once.