Exemplo n.º 1
0
 def test__is_safe_absolute_not_safe(self):
     '''Absolute paths that leak also aren't allowed.'''
     resource = DerrickRootResource()
     self.assertFalse(resource._is_safe('/etc/passwd'))
Exemplo n.º 2
0
 def test__is_safe_double_dots_leak(self):
     '''Double dots aren't allowed if they leak.'''
     resource = DerrickRootResource()
     self.assertFalse(resource._is_safe('../safefile'))
Exemplo n.º 3
0
 def test__is_safe_with_directory(self):
     '''Files inside directories inside root are okay.'''
     resource = DerrickRootResource()
     self.assertTrue(resource._is_safe('foo/safefile'))
Exemplo n.º 4
0
 def test__is_safe_double_dots(self):
     '''Double dots are allowed if they don't leak.'''
     resource = DerrickRootResource()
     self.assertTrue(resource._is_safe('foo/../safefile'))
Exemplo n.º 5
0
 def test__is_safe(self):
     '''Files inside root are okay.'''
     resource = DerrickRootResource()
     self.assertTrue(resource._is_safe('safefile'))