diff --git a/README.md b/README.md index 67c7283..b2a0080 100644 --- a/README.md +++ b/README.md @@ -101,11 +101,13 @@ docker run -it -v /path/to/your/.kube/config:/root/.kube/config \ | `defectDojoEvalEngagementName` | `"false"` | Specifies whether the engagement name should be evaluated as a python function. | | `defectDojoEvalProductName` | `"false"` | Specifies whether the product name should be evaluated as a python function. | | `defectDojoEvalProductTypeName` | `"false"` | Specifies whether the product type name should be evaluated as a python function. | +| `defectDojoEvalServiceName` | `"false"` | Specifies whether the service name should be evaluated as a python function. | | `defectDojoEvalEnvName` | `"false"` | Specifies whether the enviroment type name should be evaluated as a python function. | | `defectDojoEvalTestTitle` | `"false"` | Specifies whether the test title should be evaluated as a python function. | | `defectDojoMinimumSeverity` | `Info` | The minimum severity level for findings in DefectDojo. | | `defectDojoProductName` | `product` | The name of the product in DefectDojo. | -| `defectDojoProductTypeName` | `` | The type of the product in DefectDojo. | +| `defectDojoProductTypeName` | `Research and Development` | The type of the product in DefectDojo. | +| `defectDojoServiceName` | `` | The name of the service in DefectDojo. | | `defectDojoEnvName` | `Development` | The type of the env in DefectDojo. | | `defectDojoPushToJira` | `"false"` | Specifies whether findings should be pushed to Jira in DefectDojo. | | `defectDojoTestTitle` | `Kubernetes` | The title of the test in DefectDojo. | diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index e0ecc85..77d3a91 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -84,6 +84,12 @@ spec: - name: DEFECT_DOJO_EVAL_PRODUCT_NAME value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoEvalProductName }} + - name: DEFECT_DOJO_SERVICE_NAME + value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoServiceName + }} + - name: DEFECT_DOJO_EVAL_SERVICE_NAME + value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoEvalServiceName + }} - name: DEFECT_DOJO_DO_NOT_REACTIVATE value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoDoNotReactivate }} diff --git a/src/handlers.py b/src/handlers.py index 2e76825..024f3d5 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -106,6 +106,11 @@ def send_to_dojo(body, meta, logger, **_): if settings.DEFECT_DOJO_EVAL_PRODUCT_TYPE_NAME else settings.DEFECT_DOJO_PRODUCT_TYPE_NAME ) + _DEFECT_DOJO_SERVICE_NAME = ( + eval(settings.DEFECT_DOJO_SERVICE_NAME) + if settings.DEFECT_DOJO_EVAL_SERVICE_NAME + else settings.DEFECT_DOJO_SERVICE_NAME + ) _DEFECT_DOJO_ENV_NAME = ( eval(settings.DEFECT_DOJO_ENV_NAME) @@ -142,6 +147,7 @@ def send_to_dojo(body, meta, logger, **_): "engagement_name": _DEFECT_DOJO_ENGAGEMENT_NAME, "product_name": _DEFECT_DOJO_PRODUCT_NAME, "product_type_name": _DEFECT_DOJO_PRODUCT_TYPE_NAME, + "service": _DEFECT_DOJO_SERVICE_NAME, "environment": _DEFECT_DOJO_ENV_NAME, "test_title": _DEFECT_DOJO_TEST_TITLE, "do_not_reactivate": settings.DEFECT_DOJO_DO_NOT_REACTIVATE, diff --git a/src/settings.py b/src/settings.py index 9715c52..16578d2 100644 --- a/src/settings.py +++ b/src/settings.py @@ -42,6 +42,13 @@ "DEFECT_DOJO_EVAL_PRODUCT_TYPE_NAME" ) +DEFECT_DOJO_SERVICE_NAME: str = os.getenv( + "DEFECT_DOJO_SERVICE_NAME", "" +) +DEFECT_DOJO_EVAL_SERVICE_NAME: bool = get_env_var_bool( + "DEFECT_DOJO_EVAL_SERVICE_TYPE_NAME" +) + DEFECT_DOJO_ENV_NAME: str = os.getenv( "DEFECT_DOJO_ENV_NAME", "Development" )