Re:The Fundamental Problem in Python 3
by oefrha on Friday December 20, 2019 @02:41AM
(#21842334)
> what if you are trying to process "foreign"(as in, not created by you) filenames, trying to validate/conform with python? I mean its a great DoS vector, which is difficult to protect against with python.
1. Have catch-all exception handling. Exception may not be your fault, exception-caused "crashing" whatever that means is entirely your fault.
1. Have catch-all exception handling. Exception may not be your fault, exception-caused "crashing" whatever that means is entirely your fault.
2. Use os.fsdecode. https://docs.python.org/3/library/os.html#os.fsdecode
3. Don't process random untrusted filenames. Sanitize if it's some sort of HTTP upload, for instance.