Hi There,
On macOS 11.6 build 20G165 (on M1 laptop) with Alfred 4.6 Build 1266 there is a slight change in the running of workflows as it seems. I most note I also have Little Snitch version 5.3.1 installed. Little Snitch is an outbound firewall so to say for MacOS.
Before I installed Alfred Build 4.6 and I ran my workflow "runChrome" which has options to run a new empty Chrome profile, ignore all TLS Errors and/or with a proxy for SSH port forward enabled this worked fine with Little Snitch as Little Snitch used the rules defined for Chrome.
Now since Alfred 4.6, at least I think that's what triggered it, when I run Chrome via this workflow, Little Snitch is asking to grant outbound network access to Alfred instead of Chrome for the actual Chrome process/Window.
My guess is that with Alfred 4.6 the way a script is launched from the workflow is different than the previous Alfred 4.5.1, almost like it's a full child process and doesn't get spawned as a more or less disconnected process. I did check to see if there was an option like this on the workflow, but I don't believe so.
As I can't attach the workflow, here is the code, this all there is to the workflow and script.
Please advice if something changed in 4.6, happy to debug / test further but would need some guidance how to do this in Alfred, as the log window for the workflow only said:
Thanks in advance!
Stijn
Workflow:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>nl.sjc.runChrome</string>
<key>category</key>
<string>Productivity</string>
<key>connections</key>
<dict>
<key>F89ECEC3-23A4-42A9-BDD2-694AE847EB41</key>
<array>
<dict>
<key>destinationuid</key>
<string>9452871A-321F-4B2B-9941-99CAF74D947C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Stijn Jonker</string>
<key>description</key>
<string>Launch Chrome</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Run Chrome</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>fixedorder</key>
<true/>
<key>items</key>
<string>[{"title":"Fresh","arg":"fresh","subtitle":"Fresh Incognito Profile"},{"title":"FreshProxy","arg":"freshproxy","subtitle":"Fresh Incognito Profile w\/ Proxy"},{"title":"FreshNoCert","arg":"freshnocert","subtitle":"Fresh Incognito Profile no cert check"},{"title":"FreshNoCertProxy","arg":"freshnocertproxy","subtitle":"Fresh Incognito Profile w\/ Proxy no cert check"},{"title":"Proxy","arg":"proxy","subtitle":"Normal Profile w\/ Proxy"}]</string>
<key>keyword</key>
<string>runchrome</string>
<key>runningsubtext</key>
<string></string>
<key>subtext</key>
<string>Which mode would you like to use?</string>
<key>title</key>
<string>RunChrome</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.listfilter</string>
<key>uid</key>
<string>F89ECEC3-23A4-42A9-BDD2-694AE847EB41</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<true/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/Users/sjcjonker/Documents/Scripts/AlfredChromeRun.sh {query}</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>9452871A-321F-4B2B-9941-99CAF74D947C</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>9452871A-321F-4B2B-9941-99CAF74D947C</key>
<dict>
<key>xpos</key>
<integer>450</integer>
<key>ypos</key>
<integer>255</integer>
</dict>
<key>F89ECEC3-23A4-42A9-BDD2-694AE847EB41</key>
<dict>
<key>xpos</key>
<integer>125</integer>
<key>ypos</key>
<integer>50</integer>
</dict>
</dict>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.0.1</string>
<key>webaddress</key>
<string>www.sjc.nl</string>
</dict>
</plist>
The (ugly) shell script called is:
#/Users/sjcjonker/Scripts/AlfredRunChrome.sh {query}
OPT=${1}
# Any command in a pipe fails, then all fail
# Unset variables are an error!
set -u -o pipefail
# Chrome CMDLine for proxy
CHROMEBIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# --incognito
CHROMEOPT="--incognito --disable-logging --disable-notifications --bwsi --disable-infobars --no-default-browser-check"
# Set chromedir
CHROMEPROFILEDIR="/tmp/ChromeProfiles"
if [ ! -d ${CHROMEPROFILEDIR} ]; then
mkdir -p ${CHROMEPROFILEDIR};
fi
MYTEMPBASE="RunChrome"
MYTMPDIR=`mktemp -d -q ${CHROMEPROFILEDIR}/${MYTEMPBASE}.XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp directory, exiting..."
exit 1
fi
# Disable first run
touch "${MYTMPDIR}/First Run"
echo '{"browser": {"confirm_to_quit": false}}' > "${MYTMPDIR}/Local State"
# Now run Chrome
if [ "${OPT-}" == "fresh" ] ; then
"${CHROMEBIN}" ${CHROMEOPT} --user-data-dir=${MYTMPDIR}
elif [ "${OPT-}" == "freshproxy" ] ; then
"${CHROMEBIN}" ${CHROMEOPT} --proxy-server=socks5://127.0.0.1:9998 --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1" --user-data-dir=${MYTMPDIR}
elif [ "${OPT-}" == "freshnocert" ] ; then
"${CHROMEBIN}" ${CHROMEOPT} --user-data-dir=${MYTMPDIR} --ignore-certificate-errors
elif [ "${OPT-}" == "freshnocertproxy" ] ; then
"${CHROMEBIN}" ${CHROMEOPT} --user-data-dir=${MYTMPDIR} --ignore-certificate-errors -proxy-server=socks5://127.0.0.1:9998 --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"
elif [ "${OPT-}" == "proxy" ] ; then
"${CHROMEBIN}" --proxy-server=socks5://127.0.0.1:9998 --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"
else
"${CHROMEBIN}"
fi
# Delete profile dir
rm -R "${MYTMPDIR}"
if [ $? -ne 0 ]; then
echo "$0: Can't remove temp directory, please check \"${MYTMPDIR}\""
exit 1
fi