Skip to content

Commit 90db899

Browse files
authored
Merge pull request #278 from splunk/fix_unintended_whitespace
Fix unintended whitespace Given the comment that this resolves issues and the only additional fix was removal of a newline in Python file, I am going to merge the PR immediately.
2 parents c1dd3ca + 9990be7 commit 90db899

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

contentctl/objects/abstract_security_content_objects/detection_abstract.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ def validate_presence_of_filter_macro(cls, value:str, info:ValidationInfo)->str:
8383
8484
8585
Args:
86-
value (Union[str, dict[str,Any]]): The search. It can either be a string (and should be
87-
SPL or a dict, in which case it is Sigma-formatted.
86+
value (str): The SPL search. It must be an SPL-formatted string.
8887
info (ValidationInfo): The validation info can contain a number of different objects.
8988
Today it only contains the director.
9089
9190
Returns:
92-
Union[str, dict[str,Any]]: The search, either in sigma or SPL format.
93-
"""
94-
91+
str: The search, as an SPL formatted string.
92+
"""
9593

9694
# Otherwise, the search is SPL.
9795

contentctl/output/conf_writer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def escapeNewlines(obj:Any):
3434
# Failing to do so will result in an improperly formatted conf files that
3535
# cannot be parsed
3636
if isinstance(obj,str):
37-
return obj.replace(f"\n"," \\\n")
37+
# Remove leading and trailing characters. Conf parsers may erroneously
38+
# Parse fields if they have leading or trailing newlines/whitespace and we
39+
# probably don't want that anyway as it doesn't look good in output
40+
return obj.strip().replace(f"\n"," \\\n")
3841
else:
3942
return obj
4043

0 commit comments

Comments
 (0)