From f22a609e776cf9ede4ccbb2265e3f434a0ff5595 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Wed, 11 Dec 2024 08:09:24 -0500 Subject: [PATCH] Fix payload handler when providing certificate keys as keywords --- .../_payload/_certificate_based_exclusions.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/falconpy/_payload/_certificate_based_exclusions.py b/src/falconpy/_payload/_certificate_based_exclusions.py index 29a1c0689..ab8908498 100644 --- a/src/falconpy/_payload/_certificate_based_exclusions.py +++ b/src/falconpy/_payload/_certificate_based_exclusions.py @@ -84,14 +84,16 @@ def certificate_based_exclusions_payload(passed_keywords: dict) -> Dict[str, Lis "issuer", "serial", "subject", "thumbprint", "valid_from", "valid_to" ] list_keys = ["children_cids", "host_groups"] + certkey = {} + for key in certificate_keys: + # Certificate keywords overridden if certificate keyword is passed + if passed_keywords.get(key, None): + certkey[key] = passed_keywords.get(key, None) + if certkey: + item["certificate"] = certkey for key in keys: if passed_keywords.get(key, None): - if key == "certificate": - item["certificate"] = {} - for cert_key in certificate_keys: - item["certificate"][cert_key] = passed_keywords.get(cert_key, None) - else: - item[key] = passed_keywords.get(key, None) + item[key] = passed_keywords.get(key, None) for key in list_keys: if passed_keywords.get(key, None): provided = passed_keywords.get(key, None)