Skip to content

Instantly share code, notes, and snippets.

@shayanb
Created July 12, 2018 17:31
Show Gist options
  • Save shayanb/1f60db4e45b57df2dba4a75150de8403 to your computer and use it in GitHub Desktop.
Save shayanb/1f60db4e45b57df2dba4a75150de8403 to your computer and use it in GitHub Desktop.
Bash script to check for affected ESLint compromised (eslint-scope@3.7.2)
#!/bin/bash
# Checks all directories in cwd for compromised eslint version
cwd=$PWD
for d in `find . -maxdepth 1 -type d`; do
cd $d
version=$(npm ls 2> /dev/null | grep eslint@ | sed -e 's/.*eslint@\([0-9.]*\).*/\1/')
if [ -n "$version" ]; then
for v in $version; do
echo "$d -> eslint@$v"
if [ "$v" = '3.7.2' ]; then
echo "COMPROMISED!!! $d"
fi
done
fi
cd $cwd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment