summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2018-10-19 15:44:17 +0530
committerKushal Pandya <kushal@gitlab.com>2018-10-19 15:44:17 +0530
commit1e1b250d4bf501954d55bdd7572f67734fde1fb2 (patch)
tree56be0e18225bd541d76b5fa13fb7aeea891bb959
parent4f23bb9caaf626dffad1ebaf875b75921dbc7307 (diff)
downloadgitlab-ce-1e1b250d4bf501954d55bdd7572f67734fde1fb2.tar.gz
Add spec to test HTML escaping while rendering autocomplete
-rw-r--r--spec/features/issues/gfm_autocomplete_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb
index 08bf9bc7243..593dc6b6690 100644
--- a/spec/features/issues/gfm_autocomplete_spec.rb
+++ b/spec/features/issues/gfm_autocomplete_spec.rb
@@ -35,6 +35,21 @@ describe 'GFM autocomplete', :js do
expect(page).to have_selector('.atwho-container')
end
+ it 'opens autocomplete menu when field starts with text with item escaping HTML characters' do
+ alert_title = 'This will execute alert<img src=x onerror=alert(2)&lt;img src=x onerror=alert(1)&gt;'
+ create(:issue, project: project, title: alert_title)
+
+ page.within '.timeline-content-form' do
+ find('#note-body').native.send_keys('#')
+ end
+
+ expect(page).to have_selector('.atwho-container')
+
+ page.within '.atwho-container #at-view-issues' do
+ expect(page.all('li').first.text).to include(alert_title)
+ end
+ end
+
it 'doesnt open autocomplete menu character is prefixed with text' do
page.within '.timeline-content-form' do
find('#note-body').native.send_keys('testing')