Exemple #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'))
Exemple #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'))
Exemple #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'))
Exemple #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'))
Exemple #5
0
 def test__is_safe(self):
     '''Files inside root are okay.'''
     resource = DerrickRootResource()
     self.assertTrue(resource._is_safe('safefile'))