Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Commit

Permalink
Sanitize marker tooltips on server for extra safety (in addition to M…
Browse files Browse the repository at this point in the history
…apbox.js sanitization)
  • Loading branch information
ankane committed Jun 3, 2020
1 parent 482db1a commit a5f60d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/blazer/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ def render_run
r[lat_index] && r[lon_index]
end.map do |r|
{
title: r.each_with_index.map{ |v, i| i == lat_index || i == lon_index ? nil : "<strong>#{@columns[i]}:</strong> #{v}" }.compact.join("<br />").truncate(140),
# Mapbox.js does sanitization with https://github.com/mapbox/sanitize-caja
# but we should do it here as well
title: r.each_with_index.map { |v, i| i == lat_index || i == lon_index ? nil : "<strong>#{ERB::Util.html_escape(@columns[i])}:</strong> #{ERB::Util.html_escape(v)}" }.compact.join("<br />").truncate(140),
latitude: r[lat_index],
longitude: r[lon_index]
}
Expand Down

0 comments on commit a5f60d2

Please # to comment.