From bc6a1d5f8b0c9c5942cfebb2313513d3b4a7ba92 Mon Sep 17 00:00:00 2001 From: Andrew Tengson Date: Wed, 15 Nov 2023 16:42:03 +0800 Subject: [PATCH] feat: Add additional key in json output for namespace based rules --- hardeneks/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hardeneks/__init__.py b/hardeneks/__init__.py index 90839f3..ae0759d 100644 --- a/hardeneks/__init__.py +++ b/hardeneks/__init__.py @@ -97,7 +97,10 @@ def ndd(): "namespace": rule.result.namespace, "resolution": rule.url, } - json_blob[rule._type][rule.pillar][rule.section][rule.message] = result + if rule._type == "namespace_based": + json_blob[rule._type][rule.pillar][rule.section][rule.result.namespace][rule.message] = result + else: + json_blob[rule._type][rule.pillar][rule.section][rule.message] = result with open(json_path, "w", encoding="utf-8") as f: json.dump(json_blob, f, ensure_ascii=False, indent=4)