Commit ffdb1c1b authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-xss' into 'master'

E2E Test to check XSS issue in @mentions autocomplete

Closes #41089

See merge request gitlab-org/gitlab-ce!29884
parents 19dc1105 4e75c713
...@@ -5,6 +5,7 @@ module QA ...@@ -5,6 +5,7 @@ module QA
module Project module Project
class Show < Page::Base class Show < Page::Base
include Page::Component::ClonePanel include Page::Component::ClonePanel
include Page::Project::SubMenus::Settings
view 'app/views/layouts/header/_new_dropdown.haml' do view 'app/views/layouts/header/_new_dropdown.haml' do
element :new_menu_toggle element :new_menu_toggle
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Project module Project
module SubMenus module SubMenus
module CiCd module CiCd
include Page::Project::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Project module Project
module SubMenus module SubMenus
module Issues module Issues
include Page::Project::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Project module Project
module SubMenus module SubMenus
module Operations module Operations
include Page::Project::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Project module Project
module SubMenus module SubMenus
module Repository module Repository
include Page::Project::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Project module Project
module SubMenus module SubMenus
module Settings module Settings
include Page::Project::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
......
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'check xss occurence in @mentions in issues' do
let(:issue_title) { 'issue title' }
it 'user mentions a user in comment' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
user = Resource::User.fabricate! do |user|
user.name = "eve <img src=x onerror=alert(2)&lt;img src=x onerror=alert(1)&gt;"
user.password = "test1234"
end
project = Resource::Project.fabricate! do |resource|
resource.name = 'xss-test-for-mentions-project'
end
project.visit!
Page::Project::Show.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |page|
page.add_member(user.username)
end
Resource::Issue.fabricate_via_browser_ui! do |issue|
issue.title = issue_title
issue.project = project
end
Page::Project::Issue::Show.perform do |show_page|
show_page.select_all_activities_filter
show_page.comment('cc-ing you here @eve')
expect do
expect(show_page).to have_content("cc-ing you here")
end.not_to raise_error # Selenium::WebDriver::Error::UnhandledAlertError
end
end
end
end
end
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