diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:36:45 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 18:36:45 +0000 |
commit | 9e4a9cda8cf0f77475195bf980a14da70ddd42a5 (patch) | |
tree | 7b3527f1485a6df5b9868ec02bb9759a5abf8986 /spec/support | |
parent | fa2f136f85f4e56ecd5ec2797cc1f58eec09f8ea (diff) | |
parent | d72b1cd0b5b01d6fec6b93d9dfe84f8302083072 (diff) | |
download | gitlab-ce-9e4a9cda8cf0f77475195bf980a14da70ddd42a5.tar.gz |
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.rb | 12 |
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 |