diff --git a/README.md b/README.md index 93adddf..28d021d 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ docker run -it -v /path/to/your/.kube/config:/root/.kube/config -e DEFECT_DOJO_A | `defectDojoPushToJira` | `"false"` | Specifies whether findings should be pushed to Jira in DefectDojo. | | `defectDojoTestTitle` | `Kubernetes` | The title of the test in DefectDojo. | | `defectDojoVerified` | `"false"` | Specifies whether findings should be marked as verified in DefectDojo. | +| `defectDojoDoNotReactivate` | `"true"` | If true the importing/reimporting will ignore uploaded active findings and not reactivate previously closed findings, while still creating new findings if there are new ones | ## A note on eval diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index 94c4d20..57c5bb8 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -78,6 +78,9 @@ spec: - name: DEFECT_DOJO_EVAL_PRODUCT_NAME value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoEvalProductName }} + - name: DEFECT_DOJO_DO_NOT_REACTIVATE + value: {{ quote .Values.operator.trivyDojoReportOperator.env.defectDojoDoNotReactivate + }} - name: KUBERNETES_CLUSTER_DOMAIN value: {{ quote .Values.kubernetesClusterDomain }} image: {{ .Values.operator.trivyDojoReportOperator.image.repository }}:{{ .Values.operator.trivyDojoReportOperator.image.tag diff --git a/charts/values.yaml b/charts/values.yaml index 0745900..44aaceb 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -19,6 +19,7 @@ operator: defectDojoCloseOldFindings: "false" defectDojoCloseOldFindingsProductScope: "false" defectDojoDeduplicationOnEngagement: "true" + defectDojoDoNotReactivate: "true" defectDojoEngagementName: engagement defectDojoEvalEngagementName: "false" defectDojoEvalProductName: "false" @@ -32,5 +33,5 @@ operator: defectDojoVerified: "false" image: repository: ghcr.io/telekom-mms/docker-trivy-dojo-operator - tag: trivy-dojo-report-operator-0.3.5@sha256:e0def24a52696acfa61ca43b508da654c5bab56b116de5764d9de55407b529eb + tag: trivy-dojo-report-operator-0.3.5 type: ClusterIP diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml index 254d084..2b27553 100644 --- a/deploy/deployment.yaml +++ b/deploy/deployment.yaml @@ -19,7 +19,7 @@ spec: serviceAccountName: trivy-dojo-report-account containers: - name: trivy-dojo-report-operator - image: ghcr.io/telekom-mms/docker-trivy-dojo-operator:0.3.3 + image: ghcr.io/telekom-mms/docker-trivy-dojo-operator:trivy-dojo-report-operator-0.3.5 livenessProbe: httpGet: path: /healthz @@ -71,3 +71,5 @@ spec: value: "product" - name: DEFECT_DOJO_EVAL_PRODUCT_NAME value: "false" + - name: DEFECT_DOJO_DO_NOT_REACTIVATE + value: "true" diff --git a/docs/LOCAL-DEVELOPMENT.md b/docs/LOCAL-DEVELOPMENT.md index 3fb1cca..3b864d4 100644 --- a/docs/LOCAL-DEVELOPMENT.md +++ b/docs/LOCAL-DEVELOPMENT.md @@ -80,6 +80,7 @@ environment for this operator. export LABEL="trivy-operator.resource.name"; export LABEL_VALUE="your_label_value"; export DEFECT_DOJO_ENGAGEMENT_NAME="test" export DEFECT_DOJO_AUTO_CREATE_CONTEXT=true + export DEFECT_DOJO_ACTIVE=true ``` - Install the Python dependencies diff --git a/src/handlers.py b/src/handlers.py index 5e1196c..4167ccd 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -102,13 +102,14 @@ def send_to_dojo(body, meta, logger, **_): "product_name": _DEFECT_DOJO_PRODUCT_NAME, "product_type_name": _DEFECT_DOJO_PRODUCT_TYPE_NAME, "test_title": _DEFECT_DOJO_TEST_TITLE, + "do_not_reactivate": settings.DEFECT_DOJO_DO_NOT_REACTIVATE, } logger.debug(data) try: response: requests.Response = requests.post( - settings.DEFECT_DOJO_URL + "/api/v2/import-scan/", + settings.DEFECT_DOJO_URL + "/api/v2/reimport-scan/", headers=headers, data=data, files=report_file, diff --git a/src/settings.py b/src/settings.py index 43c7ad1..04fc923 100644 --- a/src/settings.py +++ b/src/settings.py @@ -54,3 +54,5 @@ "DEFECT_DOJO_PRODUCT_NAME", "Research and Development" ) DEFECT_DOJO_EVAL_PRODUCT_NAME: bool = get_env_var_bool("DEFECT_DOJO_EVAL_PRODUCT_NAME") + +DEFECT_DOJO_DO_NOT_REACTIVATE: bool = get_env_var_bool("DEFECT_DOJO_DO_NOT_REACTIVATE")