diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-30 16:01:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-30 16:01:17 +0300 |
commit | a114562fb6b3b350fc08225f388234a82a2700a1 (patch) | |
tree | 73331025fa884094aadef7d0d8c20c9d24d7f71a /spec | |
parent | fce23e13968a87a1e2de96a6e945166c372736f4 (diff) |
Add latest changes from gitlab-org/security/gitlab@16-5-stable-ee
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/components/instance_path_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/components/instance_path_spec.rb b/spec/lib/gitlab/ci/components/instance_path_spec.rb index 0bdcfcfd546..4ba963b54b5 100644 --- a/spec/lib/gitlab/ci/components/instance_path_spec.rb +++ b/spec/lib/gitlab/ci/components/instance_path_spec.rb @@ -84,6 +84,20 @@ RSpec.describe Gitlab::Ci::Components::InstancePath, feature_category: :pipeline end end + shared_examples 'prevents infinite loop' do |prefix| + context "when the project path starts with '#{prefix}'" do + let(:project_path) { "#{prefix}#{project.full_path}" } + + it 'returns nil' do + result = path.fetch_content!(current_user: user) + expect(result).to be_nil + end + end + end + + it_behaves_like 'prevents infinite loop', '/' + it_behaves_like 'prevents infinite loop', '//' + context 'when fetching the latest version of a component' do let_it_be(:project) do create( |