Skip to content

Instantly share code, notes, and snippets.

@trlinkin
Created December 6, 2018 15:32
Show Gist options
  • Save trlinkin/5d6604cc169f98c28dfab2fc15d3b60a to your computer and use it in GitHub Desktop.
Save trlinkin/5d6604cc169f98c28dfab2fc15d3b60a to your computer and use it in GitHub Desktop.
#!/bin/bash
fail=0
amount=0
for f in $(git diff-tree --no-commit-id --name-only -r HEAD)
do
if [[ $f =~ lib/facter/.*rb$ ]]
then
echo "Changed Made to Ruby Fact ${f} - further review needed"
fail=1
amount=$(( amount + 1 ))
else
echo "${f} is not a Ruby Fact"
fi
done
if [ $fail -eq 1 ]
then
echo "${amount} security issues have been detected"
exit 1
else
echo "Module has no modified Ruby Facts"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment