pi_portal.modules.system.file_security

Validate entities on the local file system.

class pi_portal.modules.system.file_security.FileSecurity(file_path)[source]

Methods to validate the authenticity of local file system content.

Parameters:

file_path (str) – The path to the local file.

sha256(expected_hash)[source]

Validate the sha256 digest of this file against an expected value.

Parameters:

expected_hash (str) – The expected sha256 digest.

Raises:

FileSecurityViolation

Return type:

None

exception pi_portal.modules.system.file_security.FileSecurityViolation[source]

Raised when a local file fails a security check.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.