Commit 57fab4c6 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'security-access-dropdown-user-escape' into 'master'

: [master] Escape user names in access dropdowns

See merge request gitlab/gitlab-ee!626
parents 88280301 9e8d0829
......@@ -458,7 +458,7 @@ export default class AccessDropdown {
<li>
<a href="#" class="${isActiveClass}">
<img src="${user.avatar_url}" class="avatar avatar-inline" width="30">
<strong class="dropdown-menu-user-full-name">${user.name}</strong>
<strong class="dropdown-menu-user-full-name">${_.escape(user.name)}</strong>
<span class="dropdown-menu-user-username">${user.username}</span>
</a>
</li>
......
......@@ -123,4 +123,17 @@ describe('AccessDropdown', () => {
});
});
});
describe('userRowHtml', () => {
it('escapes users name', () => {
const user = {
avatar_url: '',
name: '<img src=x onerror=alert(document.domain)>',
username: 'test',
};
const template = dropdown.userRowHtml(user);
expect(template).not.toContain(user.name);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment