From b909d05fa8f3bffb7832ce8fd809458c73587ed4 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 19 May 2025 13:03:44 -0700 Subject: [PATCH 1/2] this is a quick fix and does not account for duplicates in other string fields, like Mitre tags, references, etc. But this is still a good and helpful check --- .../security_content_object_abstract.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py b/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py index 3105f223..6eea44b6 100644 --- a/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py +++ b/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py @@ -12,6 +12,7 @@ import pprint import uuid from abc import abstractmethod +from collections import Counter from difflib import get_close_matches from functools import cached_property from typing import List, Optional, Tuple, Union @@ -708,6 +709,15 @@ def mapNamesToSecurityContentObjects( "an error in the contentctl codebase which must be resolved." ) + # Catch all for finding duplicates in mapped content + if ( + len(duplicates := [name for name, count in Counter(v).items() if count > 1]) + > 0 + ): + raise ValueError( + f"Duplicate {cls.__name__} ({duplicates}) found in list: {v}." + ) + mappedObjects: list[Self] = [] mistyped_objects: list[SecurityContentObject_Abstract] = [] missing_objects: list[str] = [] From 3192cc7a9a1e3de280f908e590ff6de97f610728 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 19 May 2025 13:05:00 -0700 Subject: [PATCH 2/2] bump in prep for patch --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 577dccff..1f6940fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "contentctl" -version = "5.5.2" +version = "5.5.3" description = "Splunk Content Control Tool" authors = ["STRT "]