diff options
author | Nigel Kukard <nkukard@lbsd.net> | 2013-11-04 22:06:27 +0000 |
---|---|---|
committer | Nigel Kukard <nkukard@lbsd.net> | 2013-11-04 22:09:03 +0000 |
commit | c46eaca91247ccf8e6fb3b691dad028e1b084ae3 (patch) | |
tree | faed085ef880760223d9b702ed7399fe84062b83 /spec/support | |
parent | ee0e9830c1c1e4c54fd0b18fadef50f76c3680a4 (diff) | |
download | gitlab-ce-c46eaca91247ccf8e6fb3b691dad028e1b084ae3.tar.gz |
More escaping
- Database name may contain characters which are not shell friendly
- Database password could contain the same
- While we at it there is no harm in escaping generated paths too
- Refactored 2-line system(command)
Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/test_env.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 16e10b1a62b..5c6f96abc1b 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -1,4 +1,5 @@ require 'rspec/mocks' +require 'shellwords' module TestEnv extend self @@ -102,7 +103,7 @@ module TestEnv repo = repo(namespace, name) # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq - system("ln -s -f #{seed_repo_path()} #{repo}") + system("ln -s -f #{Shellwords.shellescape(seed_repo_path())} #{Shellwords.shellescape(repo)}") create_satellite(repo, namespace, name) end @@ -166,12 +167,11 @@ module TestEnv # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already satellite_dir = File.dirname(satellite_repo) FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir) - system("ln -s -f #{seed_satellite_path} #{satellite_repo}") + system("ln -s -f #{Shellwords.shellescape(seed_satellite_path)} #{Shellwords.shellescape(satellite_repo)}") end def create_temp_repo(path) FileUtils.mkdir_p path - command = "git init --quiet --bare #{path};" - system(command) + system("git init --quiet --bare #{Shellwords.shellescape(path)}") end end |