Skip to content

Instantly share code, notes, and snippets.

@smholloway
Created April 17, 2014 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smholloway/11001788 to your computer and use it in GitHub Desktop.
Save smholloway/11001788 to your computer and use it in GitHub Desktop.
Psych YAML vulnerability on Heroku
# 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