Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-29 01:01:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-29 01:01:37 +0300
commitcbc166ca72db07da07995c60bbbf4e83ba30699d (patch)
tree6c3f398e6be23b6e3c9aa03e1fe9579f815ebbe3 /spec/support
parent36c8a31d573bdd2edd4c87be63eb8dde20a79761 (diff)
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
index 06800f7cded..7e7460cd602 100644
--- a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
+++ b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
@@ -4,8 +4,9 @@ RSpec.shared_examples 'wiki pipeline imports a wiki for an entity' do
describe '#run' do
let_it_be(:bulk_import_configuration) { create(:bulk_import_configuration, bulk_import: bulk_import) }
- let_it_be(:tracker) { create(:bulk_import_tracker, entity: entity) }
- let_it_be(:context) { BulkImports::Pipeline::Context.new(tracker) }
+ let_it_be_with_reload(:tracker) { create(:bulk_import_tracker, entity: entity) }
+
+ let(:context) { BulkImports::Pipeline::Context.new(tracker) }
let(:extracted_data) { BulkImports::Pipeline::ExtractedData.new(data: {}) }
@@ -40,5 +41,21 @@ RSpec.shared_examples 'wiki pipeline imports a wiki for an entity' do
expect { subject.run }.not_to raise_error
end
end
+
+ context 'when scheme is blocked' do
+ it 'prevents import' do
+ # Force bulk_import_configuration to have a file:// URL
+ bulk_import_configuration.url = 'file://example.com'
+ bulk_import_configuration.save!(validate: false)
+
+ expect(subject).to receive(:source_wiki_exists?).and_return(true)
+
+ subject.run
+
+ expect(tracker.failed?).to eq(true)
+ expect(tracker.entity.failures.first).to be_present
+ expect(tracker.entity.failures.first.exception_message).to eq('Only allowed schemes are http, https')
+ end
+ end
end
end