dangerzone
dangerzone copied to clipboard
Prevent user from using illegal characters in output filename
This should resolve issue #362 by validating that output filenames contain no illegal characters.
I've used the Python re
module for validation, and created IllegalOutputFilenameException
to be raised in the case of an invalid filename. I also updated test_document.py
to include a unit test for this new exception type.
Filenames are checked against a universal set of illegal characters: <>:"|?*. I believe it's best practice to make the character set system-agnostic, though someone with more knowledge of the security implications could update the feature to derive the character set directly from the host system using sanitize_filename
from the pathvalidate
library.
My branch is open to edits if there are any changes that need to be made.