diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-10-19 15:44:17 +0530 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-10-19 15:44:17 +0530 |
commit | 1e1b250d4bf501954d55bdd7572f67734fde1fb2 (patch) | |
tree | 56be0e18225bd541d76b5fa13fb7aeea891bb959 | |
parent | 4f23bb9caaf626dffad1ebaf875b75921dbc7307 (diff) | |
download | gitlab-ce-1e1b250d4bf501954d55bdd7572f67734fde1fb2.tar.gz |
Add spec to test HTML escaping while rendering autocomplete
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 15 |
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)<img src=x onerror=alert(1)>' + 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') |