diff --git a/run_electrum b/run_electrum index df45836e1..e0fd8457f 100755 --- a/run_electrum +++ b/run_electrum @@ -107,6 +107,15 @@ if is_android: ctypes.pythonapi = ctypes.PyDLL("libpython%d.%d.so" % sys.version_info[:2]) # replaces ctypes.PyDLL(None) +# Set default application-wide file umask to more restrictive than typical. +# We want to create all files and directories (esp. inside the datadir) with locked-down permissions. +# note: this helps even on Windows! (see https://docs.python.org/3/library/os.html#os.mkdir) +# > `os.mkdir(path, mode=0o777, *, dir_fd=None)` +# > On Windows, a mode of 0o700 is specifically handled to apply access control to the new +# > directory such that only the current user and administrators have access. +os.umask(0o0077) + + sys._ELECTRUM_RUNNING_VIA_RUNELECTRUM = True # used by logging.py from electrum.logging import get_logger, configure_logging # import logging submodule first