Skip to content

Commit

Permalink
Merge pull request #333 from scouttyg/kandan-330-xss
Browse files Browse the repository at this point in the history
Fixed XSS vulnerability by sanitizing fields when adding via Javascript
  • Loading branch information
fusion94 committed Apr 17, 2014
2 parents 3b0e13d + 5c9c84f commit 7ac2180
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Kandan.Plugins.UserList
@template: _.template '''
<li class="user" title="<%= name %>">
<img class="avatar" src="<%= avatarUrl %>"/>
<%= name %><% if(admin){ %> <span class="badge badge-important">Admin</span><% } %>
<%- name %><% if(admin){ %> <span class="badge badge-important">Admin</span><% } %>
</li>
'''

Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<%= yield :head %>
<%- if user_signed_in? %>
<%= javascript_tag do %>
$.data(document, "current-user", <%= current_user_data.to_json.html_safe %>);
$.data(document, "current-user", <%= sanitize(current_user_data.to_json.html_safe) %>);
<% end %>
<%- end %>
</head>
Expand Down

0 comments on commit 7ac2180

Please sign in to comment.