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:
authorYorick Peterse <yorickpeterse@gmail.com>2019-03-04 21:36:45 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2019-03-04 21:36:45 +0300
commit9e4a9cda8cf0f77475195bf980a14da70ddd42a5 (patch)
tree7b3527f1485a6df5b9868ec02bb9759a5abf8986 /spec/support
parentfa2f136f85f4e56ecd5ec2797cc1f58eec09f8ea (diff)
parentd72b1cd0b5b01d6fec6b93d9dfe84f8302083072 (diff)
Merge branch 'security-56348' into 'master'
Check snippet attached file to be moved is within designated directory Closes #2806 See merge request gitlab/gitlabhq!2903
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/file_mover_helpers.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/support/helpers/file_mover_helpers.rb b/spec/support/helpers/file_mover_helpers.rb
new file mode 100644
index 00000000000..1ba7cc03354
--- /dev/null
+++ b/spec/support/helpers/file_mover_helpers.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module FileMoverHelpers
+ def stub_file_mover(file_path, stub_real_path: nil)
+ file_name = File.basename(file_path)
+ allow(Pathname).to receive(:new).and_call_original
+
+ expect_next_instance_of(Pathname, a_string_including(file_name)) do |pathname|
+ allow(pathname).to receive(:realpath) { stub_real_path || pathname.cleanpath }
+ end
+ end
+end