Skip to content

Commit

Permalink
Merge pull request #78 from Agilicus/add-service
Browse files Browse the repository at this point in the history
feat: add support for setting 'Service'
  • Loading branch information
szEvEz authored Nov 25, 2024
2 parents 34f6e9b + bc7f6f0 commit 84afbf5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
6 changes: 6 additions & 0 deletions charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}}
Expand Down
6 changes: 6 additions & 0 deletions src/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 84afbf5

Please sign in to comment.