Commit 1966775f authored by Donald Cook's avatar Donald Cook

Escape html in iteration description

parent a6e27643
......@@ -157,7 +157,7 @@ export default {
</gl-new-dropdown>
</div>
<h3 ref="title" class="page-title">{{ iteration.title }}</h3>
<div ref="description" v-html="iteration.description"></div>
<div ref="description" v-text="iteration.description"></div>
<iteration-report-summary :group-path="groupPath" :iteration-id="iteration.id" />
<iteration-report-tabs :group-path="groupPath" :iteration-id="iteration.id" />
</template>
......
......@@ -91,5 +91,22 @@ describe('Iterations tabs', () => {
expect(findTitle().text()).toContain(iteration.title);
expect(findDescription().text()).toContain(iteration.description);
});
it('escapes html in description', async () => {
wrapper.setData({
group: {
iteration: {
...iteration,
description: `<img src=x onerror=alert(document.domain)>`,
},
},
});
await wrapper.vm.$nextTick();
expect(findDescription().html()).toEqual(
'<div>&lt;img src=x onerror=alert(document.domain)&gt;</div>',
);
});
});
});
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