Skip to content

Commit

Permalink
Security Fix again, thanks to Yasin Soliman
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRambaud committed Nov 14, 2017
1 parent 52b9d60 commit 9659f9b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
gemirro (0.14.0)
gemirro (0.15.0)
builder (~> 3.2)
confstruct (~> 1.0)
erubis (~> 2.7)
Expand Down
11 changes: 11 additions & 0 deletions lib/gemirro/server.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'sinatra/base'
require 'thin'
require 'uri'

module Gemirro
##
Expand Down Expand Up @@ -271,6 +272,16 @@ def spec_for(gemname, version, platform = 'ruby')
def escape(string)
Rack::Utils.escape_html(string)
end

##
# Homepage link
#
# @param [Gem] spec
# @return [String]
#
def homepage(spec)
URI.parse(URI.escape(spec.homepage))
end
end
end
end
2 changes: 1 addition & 1 deletion views/gem.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ul class="list-group">
<% spec.authors.each do |author| %>
<li class="list-group-item">
<a href="<%= escape(spec.homepage) %>"><%= escape(author) %></a>
<a href="<%= homepage(spec) %>"><%= escape(author) %></a>
</li>
<% end %>
</ul>
Expand Down

0 comments on commit 9659f9b

Please sign in to comment.