Commit 9852304b authored by Felipe Artur Cardozo's avatar Felipe Artur Cardozo

Merge branch 'security-ide-branch-name-xss' into 'master'

[master] Fixed XSS in branch name in Web IDE

See merge request gitlab/gitlabhq!2431
parents dae85363 0a59ccac
<script>
import _ from 'underscore';
import { mapActions, mapState, mapGetters } from 'vuex';
import { sprintf, __ } from '~/locale';
import * as consts from '../../stores/modules/commit/constants';
......@@ -14,7 +15,7 @@ export default {
commitToCurrentBranchText() {
return sprintf(
__('Commit to %{branchName} branch'),
{ branchName: `<strong class="monospace">${this.currentBranchId}</strong>` },
{ branchName: `<strong class="monospace">${_.escape(this.currentBranchId)}</strong>` },
false,
);
},
......
---
title: Fixed XSS in branch name in Web IDE
merge_request:
author:
type: security
......@@ -46,4 +46,12 @@ describe('IDE commit sidebar actions', () => {
done();
});
});
describe('commitToCurrentBranchText', () => {
it('escapes current branch', () => {
vm.$store.state.currentBranchId = '<img src="x" />';
expect(vm.commitToCurrentBranchText).not.toContain('<img src="x" />');
});
});
});
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