Skip to content

Commit

Permalink
Fixed XSS vulnerability by sanitizing fields when adding via Javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
scouttyg committed Apr 17, 2014
1 parent 3b0e13d commit 5c9c84f
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 5c9c84f

Please sign in to comment.