The current implementation of B103: set_bad_file_permissions works well for uses of the chmod functions from the os module directly.
It fails to report insecure permissions when the equivalent functions from the pathlib module are being used instead.
As a simple example, consider:
import pathlib
p = pathlib.Path("dummy_file")
p.chmod(0o666)
This should trigger an equivalent warning just as os.chmod("dummy_file", 0o666) currently does.
The code should be generalized to support the pathlib version of the chmod functions as well.
The current implementation of B103: set_bad_file_permissions works well for uses of the chmod functions from the
osmodule directly.It fails to report insecure permissions when the equivalent functions from the
pathlibmodule are being used instead.As a simple example, consider:
This should trigger an equivalent warning just as
os.chmod("dummy_file", 0o666)currently does.The code should be generalized to support the
pathlibversion of the chmod functions as well.