Skip to content

Instantly share code, notes, and snippets.

@KevinMcHugh
Last active August 29, 2015 14:01
Show Gist options
  • Save KevinMcHugh/fab941ec3677f9a19ee0 to your computer and use it in GitHub Desktop.
Save KevinMcHugh/fab941ec3677f9a19ee0 to your computer and use it in GitHub Desktop.
Tests for vulnerability to new Rails Unsafe Query Risk
# https://groups.google.com/forum/#!topic/rubyonrails-security/8CVoclw-Xkk
# be rails r test_for_query_risk_vuln.rb, no guarantee that it's perfect.
Rails.application.eager_load!
vulnerable = ActiveRecord::Base.descendants.map do |klass|
klass.to_s if klass.column_names.include? klass.to_s.underscore.pluralize
end.uniq
puts "Take a look at #{vulnerable}!!!!!!" unless vulnerable.compact.empty?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment