3 ms·
This should work to find affected versions on macOS. I'm on Ventura and sort has the -V version sort option. Not sure if all versions of macOS do. verlte() {
by mdeeks 4y ago
This should work to find affected versions on macOS. I'm on Ventura and sort has the -V version sort option. Not sure if all versions of macOS do.
verlte() {
# Returns code 0 if first arg is less than or equal two the second arg
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
}
vscode_version=$(/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code -v | head -n 1)
vulnerable_version="1.71.1"
if verlte $vscode_version $vulnerable_version; then
echo 'Vulnerable version!'
else
echo "Up to date version"
fi
- cosmotic 4y agoIt might be worth doing a full file system scan so it catches the app in locations other than /Applications