Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for setting 'Service' #78

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading