Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

HTML escaping in the 2.3 stable branch #10

Open
wants to merge 2 commits into
base: 2-3-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/exception_notification/notifier_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ module ExceptionNotification::NotifierHelper
PARAM_FILTER_REPLACEMENT = "[FILTERED]"

def render_section(section)
RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}")
summary = render("exception_notifier/#{section}").strip
unless summary.blank?
title = render("exception_notifier/title", :locals => { :title => section }).strip
title = render("exception_notifier/title", :title => section).strip
"#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
end
end
Expand Down
2 changes: 1 addition & 1 deletion views/exception_notifier/_backtrace.rhtml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= @backtrace.join "\n" %>
<%=raw @backtrace.join "\n" %>
6 changes: 3 additions & 3 deletions views/exception_notifier/_environment.rhtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%>
<% @request.env.keys.sort.each do |key| -%>
* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
* <%=raw "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
<% end -%>

* Process: <%= $$ %>
* Server : <%= `hostname -s`.chomp %>
* Process: <%=raw $$ %>
* Server : <%=raw `hostname -s`.chomp %>
8 changes: 4 additions & 4 deletions views/exception_notifier/_request.rhtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* URL : <%= @request.protocol %><%= @host %><%= @request.request_uri %>
* IP address: <%= @request.env["HTTP_X_FORWARDED_FOR"] || @request.env["REMOTE_ADDR"] %>
* Parameters: <%= filter_sensitive_post_data_parameters(@request.parameters).inspect %>
* Rails root: <%= @rails_root %>
* URL : <%=raw @request.url %>
* IP address: <%=raw @request.remote_ip %>
* Parameters: <%=raw filter_sensitive_post_data_parameters(@request.parameters).inspect %>
* Rails root: <%=raw Rails.root %>
4 changes: 2 additions & 2 deletions views/exception_notifier/_session.rhtml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* session id: <%= @request.session_options[:id] %>
* data: <%= @request.session.inspect %>
* session id: <%=raw @request.session_options[:id] %>
* data: <%=raw PP.pp @request.session.inspect.gsub(/\n/, "\n ").strip.html_safe %>
2 changes: 1 addition & 1 deletion views/exception_notifier/_title.rhtml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-------------------------------
<%= title.to_s.humanize %>:
<%=raw title.to_s.humanize %>:
-------------------------------
6 changes: 3 additions & 3 deletions views/exception_notifier/exception_notification.rhtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A <%= @exception.class %> occurred <%= @exception_source %>:

<%= @exception.message %>
<%= @backtrace.first %>
<%=raw @exception.message %>
<%=raw @backtrace.first %>

<%= @sections.map { |section| render_section(section) }.join %>
<%=raw @sections.map { |section| render_section(section) }.join %>