Commit 2ec919be authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'port-iterations-sec' into 'master'

Escape html in iteration description

See merge request gitlab-org/gitlab!37340
parents c6956430 1966775f
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
</gl-new-dropdown> </gl-new-dropdown>
</div> </div>
<h3 ref="title" class="page-title">{{ iteration.title }}</h3> <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-summary :group-path="groupPath" :iteration-id="iteration.id" />
<iteration-report-tabs :group-path="groupPath" :iteration-id="iteration.id" /> <iteration-report-tabs :group-path="groupPath" :iteration-id="iteration.id" />
</template> </template>
......
...@@ -91,5 +91,22 @@ describe('Iterations tabs', () => { ...@@ -91,5 +91,22 @@ describe('Iterations tabs', () => {
expect(findTitle().text()).toContain(iteration.title); expect(findTitle().text()).toContain(iteration.title);
expect(findDescription().text()).toContain(iteration.description); 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