BigW Consortium Gitlab

Commit bf86fba0 by Phil Hughes Committed by Filipa Lacerda

Merge branch 'security_issue_42029' into 'security-10-6'

Sanitizes user name to avoid XSS attacks See merge request gitlab/gitlabhq!2365
parent 99845d95
import _ from 'underscore';
function isValidProjectId(id) {
return id > 0;
}
......@@ -41,7 +43,7 @@ class SidebarMoveIssue {
renderRow: project => `
<li>
<a href="#" class="js-move-issue-dropdown-item">
${project.name_with_namespace}
${_.escape(project.name_with_namespace)}
</a>
</li>
`,
......
---
title: Sanitizes user name to avoid XSS attacks
merge_request:
author:
type: security
......@@ -130,7 +130,7 @@ const RESPONSE_MAP = {
'name_with_namespace': 'No project',
}, {
'id': 20,
'name_with_namespace': 'foo / bar',
'name_with_namespace': '<img src=x onerror=alert(document.domain)> foo / bar',
},
],
},
......
......@@ -68,6 +68,15 @@ describe('SidebarMoveIssue', () => {
expect($.fn.glDropdown).toHaveBeenCalled();
});
it('escapes html from project name', (done) => {
this.$toggleButton.dropdown('toggle');
setTimeout(() => {
expect(this.$content.find('.js-move-issue-dropdown-item')[1].innerHTML.trim()).toEqual('&lt;img src=x onerror=alert(document.domain)&gt; foo / bar');
done();
});
});
});
describe('onConfirmClicked', () => {
......
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