From bcee80029dc1ff1042e7abc8f84c3f102704cfe5 Mon Sep 17 00:00:00 2001 From: Bhavin Patel Date: Thu, 22 Jun 2023 16:26:43 -0700 Subject: [PATCH 1/3] new line check --- .../contentctl_core/domain/entities/detection.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/contentctl_project/contentctl_core/domain/entities/detection.py b/bin/contentctl_project/contentctl_core/domain/entities/detection.py index fe3fdfe2b6..2f534bcd51 100644 --- a/bin/contentctl_project/contentctl_core/domain/entities/detection.py +++ b/bin/contentctl_project/contentctl_core/domain/entities/detection.py @@ -6,6 +6,7 @@ from pydantic import BaseModel, validator, root_validator from dataclasses import dataclass from datetime import datetime from typing import Union +import re from bin.contentctl_project.contentctl_core.domain.entities.security_content_object import ( @@ -139,6 +140,15 @@ class Detection(BaseModel, SecurityContentObject): raise ValueError("name is longer then 67 chars: " + values["name"]) return values + + @root_validator + def description_new_line_check(cls, values): + # Check if there is a new line in description that is not escaped + pattern = r'(? Date: Tue, 11 Jul 2023 14:16:33 -0500 Subject: [PATCH 2/3] check for howto --- .../contentctl_core/domain/entities/detection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/contentctl_project/contentctl_core/domain/entities/detection.py b/bin/contentctl_project/contentctl_core/domain/entities/detection.py index 2f534bcd51..bc9ed22270 100644 --- a/bin/contentctl_project/contentctl_core/domain/entities/detection.py +++ b/bin/contentctl_project/contentctl_core/domain/entities/detection.py @@ -142,11 +142,14 @@ class Detection(BaseModel, SecurityContentObject): @root_validator - def description_new_line_check(cls, values): - # Check if there is a new line in description that is not escaped + def new_line_check(cls, values): + # Check if there is a new line in description and how to implement that is not escaped pattern = r'(? Date: Tue, 11 Jul 2023 12:57:22 -0700 Subject: [PATCH 3/3] Update error message to be more descriptive for newline validation. --- .../contentctl_core/domain/entities/detection.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/contentctl_project/contentctl_core/domain/entities/detection.py b/bin/contentctl_project/contentctl_core/domain/entities/detection.py index bc9ed22270..57d1c1a02a 100644 --- a/bin/contentctl_project/contentctl_core/domain/entities/detection.py +++ b/bin/contentctl_project/contentctl_core/domain/entities/detection.py @@ -146,10 +146,15 @@ class Detection(BaseModel, SecurityContentObject): # Check if there is a new line in description and how to implement that is not escaped pattern = r'(?