Skip to content
Snippets Groups Projects
Commit 2aa86523 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Add tests for path traversal errors

parent 633b2aaa
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -83,6 +83,12 @@ class TestGit < Test::Unit::TestCase
assert_equal 'bar', @git.fs_read('foo')
end
 
def test_fs_read_path_traversal
assert_raise RuntimeError do
@git.fs_read('../foo')
end
end
def test_fs_write
f = stub
f.expects(:write).with('baz')
Loading
Loading
@@ -91,6 +97,12 @@ class TestGit < Test::Unit::TestCase
@git.fs_write('foo/bar', 'baz')
end
 
def test_fs_write_path_traversal
assert_raise RuntimeError do
@git.fs_read('../foo/bar')
end
end
def test_fs_delete
FileUtils.expects(:rm_rf).with(File.join(@git.git_dir, 'foo'))
@git.fs_delete('foo')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment