Created
April 17, 2014 18:03
-
-
Save smholloway/11001788 to your computer and use it in GitHub Desktop.
Psych YAML vulnerability on Heroku
This file contains hidden or 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
# Built from https://gist.github.com/markpundsack/4506402 | |
`heroku list`.split("\n").each do |app| | |
app = app.strip | |
# Some "heroku apps" lines have === formatting for grouping. They're not apps. | |
next if app[0..2] == "===" | |
# Some are appended by owner emails | |
app = app.split(" ")[0].to_s.strip | |
# Blank lines can be ommitted. | |
next if app == "" | |
yaml_version = `heroku run \"ruby -rpsych -e \\"p Psych.libyaml_version.join('.')\\"\" -a #{app}` | |
if yaml_version.include?('LoadError') | |
puts "#{app} is fine..." | |
else | |
puts "Please fix YAML for #{app}!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment