mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 11:45:18 +08:00
Fix XSS vulnerability in protocol keywords [SCI-632]
This commit is contained in:
parent
4b50c73474
commit
d798f1b120
2 changed files with 6 additions and 2 deletions
|
@ -159,6 +159,10 @@ class ProtocolsController < ApplicationController
|
|||
|
||||
def update_keywords
|
||||
respond_to do |format|
|
||||
# sanitize user input
|
||||
params[:keywords].collect! do |keyword|
|
||||
ActionController::Base.helpers.sanitize(keyword)
|
||||
end
|
||||
if @protocol.update_keywords(params[:keywords])
|
||||
format.json {
|
||||
render json: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @protocol.protocol_keywords.count > 0 %>
|
||||
<%= @protocol.protocol_keywords.collect{ |kw| "<strong>#{kw.name}</strong>" }.join(", ").html_safe %>
|
||||
<%= @protocol.protocol_keywords.collect{ |kw| "<strong>#{sanitize(kw.name)}</strong>" }.join(", ").html_safe %>
|
||||
<% else %>
|
||||
<em><%= t("protocols.no_keywords") %></em>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue