backend.globaleaks.utils.fs

Module Contents

Functions

overwrite_and_remove(absolutefpath, iterations_number=1) Overwrite the file with all_zeros, all_ones, random patterns
directory_traversal_check(trusted_absolute_prefix, untrusted_path) Check that an ‘untrusted_path’ matches a ‘trusted_absolute_path’ prefix
get_disk_space(path)
read_file(p)
read_json_file(p)
backend.globaleaks.utils.fs.overwrite_and_remove(absolutefpath, iterations_number=1)[source]

Overwrite the file with all_zeros, all_ones, random patterns

This feature is a legacy security measure known to has important drawbacks and to not be effective on all the situations as it depends on specific filesystems and storage devices.

the effective solution on which the system does relies is encryption and this feature is maintained just as additional countermeasure and for educational and historical reasons.

Parameters:
  • absolutefpath – the absolute path of the file to overwrite
  • iterations_number – the number of overwrite operations
backend.globaleaks.utils.fs.directory_traversal_check(trusted_absolute_prefix, untrusted_path)[source]

Check that an ‘untrusted_path’ matches a ‘trusted_absolute_path’ prefix

Parameters:
  • trusted_absolute_prefix – A prefix of the sandbox
  • untrusted_path – The untrasted path
backend.globaleaks.utils.fs.get_disk_space(path)[source]
backend.globaleaks.utils.fs.read_file(p)[source]
backend.globaleaks.utils.fs.read_json_file(p)[source]