summaryrefslogtreecommitdiff
path: root/test/test_tmpdir.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-04-01 01:17:45 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-04-05 21:08:57 +0900
commit4b6fa03a72b23fa03a8f37cbfdcad3f0251832cf (patch)
treef4272d22879e461ffbf4a4de34e17759b8b4082c /test/test_tmpdir.rb
parent2f992272f20d29fe20e70555ffabe09cf80d8655 (diff)
[ruby/tmpdir] Make usable chars more strict
Remove other than alphanumeric and some punctuations considered filesystem-safe, instead of removing some unsafe chars only. https://hackerone.com/reports/1131465 https://github.com/ruby/tmpdir/commit/adf294bc2d
Diffstat (limited to 'test/test_tmpdir.rb')
-rw-r--r--test/test_tmpdir.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb
index c56fd5f401..7ef9f59b54 100644
--- a/test/test_tmpdir.rb
+++ b/test/test_tmpdir.rb
@@ -97,8 +97,10 @@ class TestTmpdir < Test::Unit::TestCase
target = target.chomp('/') + '/'
traversal_path = target.sub(/\A\w:/, '') # for DOSISH
traversal_path = Array.new(target.count('/')-2, '..').join('/') + traversal_path
- actual = yield traversal_path
- assert_not_send([File.absolute_path(actual), :start_with?, target])
+ [File::SEPARATOR, File::ALT_SEPARATOR].compact.each do |separator|
+ actual = yield traversal_path.tr('/', separator)
+ assert_not_send([File.absolute_path(actual), :start_with?, target])
+ end
end
end
end