diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-10 16:55:31 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-10 16:44:20 +0200 |
commit | 9ae401cf91c9d545602b9aa86afcd306fc6e3467 (patch) | |
tree | c59b95944a4daeeace1f9e368872760270164c6a /spec/helpers | |
parent | da13d1af3ecfdf124d63c5cf53aca6cac8a9f36d (diff) | |
download | gitlab-ce-9ae401cf91c9d545602b9aa86afcd306fc6e3467.tar.gz |
Merge branch 'rs-sanitize-submodule-urls' into 'security'
Sanitize submodule URLs before linking to them in the file tree view
See merge request !2084
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/submodule_helper_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index 345bc33a67b..9da33792659 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -109,6 +109,18 @@ describe SubmoduleHelper do end context 'submodule on unsupported' do + it 'sanitizes unsupported protocols' do + stub_url('javascript:alert("XSS");') + + expect(helper.submodule_links(submodule_item)).to eq([nil, nil]) + end + + it 'sanitizes unsupported protocols disguised as a repository URL' do + stub_url('javascript:alert("XSS");foo/bar.git') + + expect(helper.submodule_links(submodule_item)).to eq([nil, nil]) + end + it 'returns original' do stub_url('http://mygitserver.com/gitlab-org/gitlab-ce') expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil]) |