Skip to content

Instantly share code, notes, and snippets.

@grantr
Created October 13, 2011 19:09
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 grantr/1285189 to your computer and use it in GitHub Desktop.
Save grantr/1285189 to your computer and use it in GitHub Desktop.
script to find rails 3 xss issues
# run from rails root
Dir.glob("app/views/**/*.*").each do |filename|
File.open(filename) do |f|
f.each_with_index do |line, i|
line.scan /[^"]"([^"]+)"/ do |match|
m = match.first
puts "#{f.path} :#{i+1} #{m}" if m =~ /(<[^%]|[^=%]>)/
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment