Skip to content

Commit bf5d489

Browse files
Merge branch 'bugfix' into fix_questionnaireg
2 parents 9afc8f8 + 5b610e4 commit bf5d489

7 files changed

Lines changed: 79 additions & 20 deletions

File tree

.github/workflows/test-helm-chart.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,27 +125,25 @@ jobs:
125125
chart-search-root: "helm/defectdojo"
126126
git-push: true
127127

128-
# Documentation provided in the README file needs to contain the latest information from `values.yaml` and all other related assets.
129-
# If this step fails, install https://github.com/norwoodj/helm-docs and run locally `helm-docs --chart-search-root helm/defectdojo` before committing your changes.
130-
# The helm-docs documentation will be generated for you.
131128
- name: Run helm-docs (check)
132129
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
133130
if: ${{ !(startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'dependabot/')) }}
134131
with:
135132
fail-on-diff: true
136133
chart-search-root: "helm/defectdojo"
137134

135+
- name: Failed Information
136+
if: failure()
137+
run: |-
138+
echo "Your HELM chart changed but you haven't adjusted documentation. Check https://github.com/defectdojo/django-DefectDojo/tree/master/helm/defectdojo#helm-docs-update for more information."
139+
138140
generate_schema:
139141
name: Update schema
140142
runs-on: ubuntu-latest
141143
steps:
142144
- name: Checkout
143145
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
144146

145-
# The HELM structure supports the existence of a `values.schema.json` file. This file is used to validate all values provided by the user before Helm starts rendering templates.
146-
# The chart needs to have a `values.schema.json` file that is compatible with the default `values.yaml` file.
147-
# If this step fails, install https://github.com/losisin/helm-values-schema-json and run locally `helm schema --use-helm-docs` in `helm/defectdojo` before committing your changes.
148-
# The helm schema will be generated for you.
149147
- name: Generate values schema json
150148
uses: losisin/helm-values-schema-json-action@660c441a4a507436a294fc55227e1df54aca5407 # v2.3.1
151149
with:
@@ -154,6 +152,11 @@ jobs:
154152
useHelmDocs: true
155153
values: values.yaml
156154

155+
- name: Failed Information
156+
if: failure()
157+
run: |-
158+
echo "Your HELM chart changed but you haven't adjusted schema. Check https://github.com/defectdojo/django-DefectDojo/tree/master/helm/defectdojo#helm-schema-update for more information."
159+
157160
lint_format:
158161
name: Lint chart (format)
159162
runs-on: ubuntu-latest

dojo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# Django starts so that shared_task will use this app.
55
from .celery import app as celery_app # noqa: F401
66

7-
__version__ = "2.52.1"
7+
__version__ = "2.52.2"
88
__url__ = "https://github.com/DefectDojo/django-DefectDojo"
99
__docs__ = "https://documentation.defectdojo.com"

dojo/tools/qualys/parser.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,16 @@ def parse_finding(host, tree):
311311
split_cvss(cvss2, temp)
312312
# DefectDojo does not support cvssv2
313313
temp["CVSS_vector"] = None
314-
315314
# CVE and LINKS
316-
temp_cve_details = vuln_item.iterfind("CVE_ID_LIST/CVE_ID")
317-
if temp_cve_details:
318-
cl = {
319-
cve_detail.findtext("ID"): cve_detail.findtext("URL")
320-
for cve_detail in temp_cve_details
321-
}
322-
temp["cve"] = "\n".join(list(cl.keys()))
323-
temp["links"] = "\n".join(list(cl.values()))
315+
temp_cve_details = [(cve.findtext("ID"), cve.findtext("URL")) for cve in vuln_item.iterfind("CVE_ID_LIST/CVE_ID")]
316+
temp["cve_list"] = [cve_id for cve_id, _ in temp_cve_details if cve_id]
317+
temp["links"] = [url for _, url in temp_cve_details if url]
324318

325319
# Generate severity from number in XML's 'SEVERITY' field, if not present default to 'Informational'
326320
sev = get_severity(vuln_item.findtext("SEVERITY"))
327321
finding = None
328322
if temp_cve_details:
329-
refs = "\n".join(list(cl.values()))
323+
refs = temp.get("links", "")
330324
finding = Finding(
331325
title="QID-" + gid[4:] + " | " + temp["vuln_name"],
332326
mitigation=temp["solution"],
@@ -363,6 +357,7 @@ def parse_finding(host, tree):
363357
finding.verified = True
364358
finding.unsaved_endpoints = []
365359
finding.unsaved_endpoints.append(ep)
360+
finding.unsaved_vulnerability_ids = temp.get("cve_list", [])
366361
ret_rows.append(finding)
367362
return ret_rows
368363

helm/defectdojo/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "2.53.0-dev"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.8.2-dev
5+
version: 1.8.3-dev
66
icon: https://defectdojo.com/hubfs/DefectDojo_favicon.png
77
maintainers:
88
- name: madchap

helm/defectdojo/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,26 @@ kubectl delete serviceAccount defectdojo
493493
kubectl delete pvc data-defectdojo-redis-0 data-defectdojo-postgresql-0
494494
```
495495
496+
## Development/contribution
497+
498+
In case you decide to help with the improvement of the HELM chart, keep in mind that values/descriptions might need to be adjusted in multiple places (see below).
499+
500+
### HELM Docs update
501+
502+
Documentation provided in the README file needs to contain the latest information from `values.yaml` and all other related assets.
503+
If GitHub Action _Lint Helm chart / Update documentation_ step fails, install https://github.com/norwoodj/helm-docs and run locally `helm-docs --chart-search-root helm/deeefectdojo` before committing your changes.
504+
The helm-docs documentation will be generated for you.
505+
506+
### HELM Schema update
507+
508+
The HELM structure supports the existence of a `values.schema.json` file. This file is used to validate all values provided by the user before Helm starts rendering templates.
509+
The chart needs to have a `values.schema.json` file that is compatible with the default `values.yaml` file.
510+
If GitHub Action _Lint Helm chart / Update schema_ step fails, install https://github.com/losisin/helm-values-schema-json and run locally `helm schema --use-helm-docs` in `helm/defectdojo` before committing your changes.
511+
The HELM schema will be generated for you.
512+
496513
# General information about chart values
497514
498-
![Version: 1.8.2-dev](https://img.shields.io/badge/Version-1.8.2--dev-informational?style=flat-square) ![AppVersion: 2.53.0-dev](https://img.shields.io/badge/AppVersion-2.53.0--dev-informational?style=flat-square)
515+
![Version: 1.8.3-dev](https://img.shields.io/badge/Version-1.8.3--dev-informational?style=flat-square) ![AppVersion: 2.53.0-dev](https://img.shields.io/badge/AppVersion-2.53.0--dev-informational?style=flat-square)
499516
500517
A Helm chart for Kubernetes to install DefectDojo
501518

helm/defectdojo/README.md.gotmpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,22 @@ kubectl delete serviceAccount defectdojo
495495
kubectl delete pvc data-defectdojo-redis-0 data-defectdojo-postgresql-0
496496
```
497497

498+
## Development/contribution
499+
500+
In case you decide to help with the improvement of the HELM chart, keep in mind that values/descriptions might need to be adjusted in multiple places (see below).
501+
502+
### HELM Docs update
503+
504+
Documentation provided in the README file needs to contain the latest information from `values.yaml` and all other related assets.
505+
If GitHub Action _Lint Helm chart / Update documentation_ step fails, install https://github.com/norwoodj/helm-docs and run locally `helm-docs --chart-search-root helm/deeefectdojo` before committing your changes.
506+
The helm-docs documentation will be generated for you.
507+
508+
### HELM Schema update
509+
510+
The HELM structure supports the existence of a `values.schema.json` file. This file is used to validate all values provided by the user before Helm starts rendering templates.
511+
The chart needs to have a `values.schema.json` file that is compatible with the default `values.yaml` file.
512+
If GitHub Action _Lint Helm chart / Update schema_ step fails, install https://github.com/losisin/helm-values-schema-json and run locally `helm schema --use-helm-docs` in `helm/defectdojo` before committing your changes.
513+
The HELM schema will be generated for you.
498514

499515
# General information about chart values
500516

unittests/tools/test_qualys_parser.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,38 @@ def test_parse_file_with_cvss_values_and_scores(self):
151151
for finding in findings:
152152
if finding.unsaved_endpoints[0].host == "demo14.s02.sjc01.qualys.com" and finding.title == "QID-370876 | AMD Processors Multiple Security Vulnerabilities (RYZENFALL/MASTERKEY/CHIMERA-FW/FALLOUT)":
153153
finding_cvssv3_score = finding
154+
self.assertEqual(
155+
finding.unsaved_vulnerability_ids,
156+
[
157+
"CVE-2018-8930",
158+
"CVE-2018-8931",
159+
"CVE-2018-8932",
160+
"CVE-2018-8933",
161+
"CVE-2018-8934",
162+
"CVE-2018-8935",
163+
"CVE-2018-8936",
164+
],
165+
)
154166
if finding.unsaved_endpoints[0].host == "demo13.s02.sjc01.qualys.com" and finding.title == "QID-370876 | AMD Processors Multiple Security Vulnerabilities (RYZENFALL/MASTERKEY/CHIMERA-FW/FALLOUT)":
155167
finding_no_cvssv3_at_detection = finding
168+
self.assertEqual(
169+
finding.unsaved_vulnerability_ids,
170+
[
171+
"CVE-2018-8930",
172+
"CVE-2018-8931",
173+
"CVE-2018-8932",
174+
"CVE-2018-8933",
175+
"CVE-2018-8934",
176+
"CVE-2018-8935",
177+
"CVE-2018-8936",
178+
],
179+
)
156180
if finding.unsaved_endpoints[0].host == "demo14.s02.sjc01.qualys.com" and finding.title == 'QID-121695 | NTP "monlist" Feature Denial of Service Vulnerability':
157181
finding_no_cvssv3 = finding
182+
self.assertEqual(
183+
finding.unsaved_vulnerability_ids,
184+
["CVE-2013-5211"],
185+
)
158186
# The CVSS Vector is not used from the Knowledgebase
159187
self.assertEqual(
160188
# CVSS_FINAL is defined without a cvssv3 vector

0 commit comments

Comments
 (0)