-
-
Save jgamblin/e91d25acec689e2cad1ff4b8b4a6e13c to your computer and use it in GitHub Desktop.
Run Bundle Audit Against A GitHub Org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
org=$1 | |
token="Get From Here: https://github.com/settings/tokens" | |
gh_repos_url="https://api.github.com/orgs/$org/repos?type=sources&per_page=1000" | |
bundle audit update &>/dev/null | |
for repo in $(curl -s -H "Authorization: token $token" "$gh_repos_url" | jsawk -n 'out(this.name)' 2>/dev/null ); do | |
status=$(curl -s -H "Authorization: token $token" --write-out "%{http_code}" -O "https://raw.githubusercontent.com/$org/$repo/master/{Gemfile,Gemfile.lock}" ) | |
if [ "$status" = 200200 ]; then | |
output=$(bundle audit check -q | grep -v "Vulnerabilities found!") | |
if [[ $output ]]; then | |
printf "Vulnerablities Found In %s: \n\n" "$repo" | |
printf "%s" "$output" | |
printf "\n\n\n" | |
else | |
: | |
fi | |
else | |
: | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment