From e753f669d702ff5bf96fc5302bd22d1e5c619109 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Sun, 19 Jan 2020 22:04:28 -0500 Subject: [PATCH 1/3] Avoid attribute error when `password_config` present but empty The old statement returned `None` for such a `password_config` (like the one created on first run), thus retrieval of the `pepper` key failed with `AttributeError`. Fixes #5315 Signed-off-by: Ivan Vilata i Balaguer --- scripts/hash_password | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/hash_password b/scripts/hash_password index a1eb0769daf4..a30767f758a1 100755 --- a/scripts/hash_password +++ b/scripts/hash_password @@ -52,7 +52,7 @@ if __name__ == "__main__": if "config" in args and args.config: config = yaml.safe_load(args.config) bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds) - password_config = config.get("password_config", {}) + password_config = config.get("password_config", None) or {} password_pepper = password_config.get("pepper", password_pepper) password = args.password From b2693d375dd050fab118abd99211446b4d1b290c Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Mon, 20 Jan 2020 21:44:29 -0500 Subject: [PATCH 2/3] Changelog --- changelog.d/6753.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6753.bugfix diff --git a/changelog.d/6753.bugfix b/changelog.d/6753.bugfix new file mode 100644 index 000000000000..7439e6de1fca --- /dev/null +++ b/changelog.d/6753.bugfix @@ -0,0 +1 @@ +Fix `AttributeError: 'NoneType' object has no attribute 'get'` in `hash_password` when configuration has an empty `password_config`. From 1bab5dc89383831c618b0ba5c5349901814c1262 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 22 Jan 2020 07:30:26 +0000 Subject: [PATCH 3/3] ack contribution --- changelog.d/6753.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/6753.bugfix b/changelog.d/6753.bugfix index 7439e6de1fca..5dfde793e1f2 100644 --- a/changelog.d/6753.bugfix +++ b/changelog.d/6753.bugfix @@ -1 +1 @@ -Fix `AttributeError: 'NoneType' object has no attribute 'get'` in `hash_password` when configuration has an empty `password_config`. +Fix `AttributeError: 'NoneType' object has no attribute 'get'` in `hash_password` when configuration has an empty `password_config`. Contributed by @ivilata.