From 72a8f9aee59d7fcb5ca4d35395feff237ef3d174 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Feb 19 2025 13:27:02 +0000 Subject: Create config file such that it is readable only by user The config file is used to store authentication tokens, so should not be readable by other users. Signed-off-by: Peter Oliver --- diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index 3d5427e..121659e 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -3217,7 +3217,7 @@ class cliClient(object): local_config.set(section, "token", TOKEN) # Write the config to the user's config file. - with open(PATH, "w") as fp: + with open(PATH, "w", opener=lambda path, flags: os.open(path, flags, mode=0o600)) as fp: try: local_config.write(fp) except configparser.ConfigParser.Error: