Skip to content

Commit a81cf78

Browse files
authored
Merge pull request #12615 from DefectDojo/release/2.47.2
Release: Merge release into master from: release/2.47.2
2 parents 37d8af6 + 3f90542 commit a81cf78

File tree

14 files changed

+1116
-27
lines changed

14 files changed

+1116
-27
lines changed

components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "defectdojo",
3-
"version": "2.47.1",
3+
"version": "2.47.2",
44
"license" : "BSD-3-Clause",
55
"private": true,
66
"dependencies": {

docs/content/en/open_source/upgrading/2.39.md

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,114 @@
22
title: 'Upgrading to DefectDojo Version 2.39.x'
33
toc_hide: true
44
weight: -20240903
5-
description: No special instructions.
5+
description: Major upgrade of Postgres 16 to 17
66
exclude_search: true
77
---
8-
There are no special instructions for upgrading to 2.39.x. Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.39.0) for the contents of the release.
8+
9+
# PostgreSQL Major Version Upgrade in Docker Compose
10+
11+
This release incorporates a major upgrade of Postgres. When using the default docker compose setup you'll need to upgrade the Postgres data folder before you can use Defect Dojo 2.39.0.
12+
13+
There are lots of online guides to be found such as https://hub.docker.com/r/tianon/postgres-upgrade or https://github.com/pgautoupgrade/docker-pgautoupgrade.
14+
15+
There's also the [official documentation on `pg_upgrade`](https://www.postgresql.org/docs/current/pgupgrade.html), but this doesn't work out of the box when using Docker containers.
16+
17+
Sometimes it's easier to just perform the upgrade manually, which would look something like the steps below.
18+
It may need some tuning to your specific needs and docker compose setup. The guide is loosely based on https://simplebackups.com/blog/docker-postgres-backup-restore-guide-with-examples.
19+
If you already have a valid backup of the postgres 16 database, you can start at step 4.
20+
21+
---
22+
23+
## 0. Backup
24+
25+
Always back up your data before starting and save it somewhere.
26+
Make sure the backup and restore is tested before continuing the steps below where the docker volume containing the database will be removed.
27+
28+
## 1. Start the Old Postgres Container
29+
30+
If you've acceidentally already updated your docker-compose.yml to the new versions, downgrade to postgres 16 for now:
31+
32+
Edit your `docker-compose.yml` to use the old Postgres version (e.g., `postgres:16.4-alpine`):
33+
34+
```yaml
35+
postgres:
36+
image: postgres:16.4-alpine
37+
...
38+
```
39+
40+
Start only the Postgres container which will now be 16.4:
41+
42+
```bash
43+
docker compose up -d postgres
44+
```
45+
46+
---
47+
48+
## 2. Dump Your Database
49+
50+
```bash
51+
docker compose exec -t postgres pg_dump -U defectdojo -Fc defectdojo -f /tmp/defectdojo.dump
52+
docker cp <postgres_container_name>:/tmp/defectdojo.dump defectdojo.dump
53+
```
54+
You can find the postgres_container_name via `docker container ls` or `docker ps`.
55+
56+
---
57+
58+
## 3. Stop Containers and Remove the Old Volume
59+
60+
You can find the volume name via `docker volume ls`.
61+
62+
```bash
63+
docker compose down
64+
docker volume rm <defectdojo_postgres_volume_name>
65+
```
66+
67+
---
68+
69+
## 4. Switch to the New Postgres Version
70+
71+
Edit your `docker-compose.yml` to use the new version (e.g., `postgres:17.5-alpine`):
72+
73+
```yaml
74+
postgres:
75+
image: postgres:17.5-alpine
76+
...
77+
```
78+
79+
---
80+
81+
## 5. Start the New Postgres Container
82+
83+
```bash
84+
docker compose up -d postgres
85+
```
86+
87+
---
88+
89+
## 6. Restore Your Database
90+
91+
**Copy the dump file into the new container:**
92+
93+
```bash
94+
docker cp defectdojo.dump <postgres_container_name>:/defectdojo.dump
95+
```
96+
97+
**Restore inside the container:**
98+
99+
```bash
100+
docker exec -it <postgres_container_name> bash
101+
pg_restore -U defectdojo -d defectdojo /defectdojo.dump
102+
```
103+
104+
---
105+
106+
## 7. Start the Rest of Your Services
107+
108+
```bash
109+
docker compose up -d
110+
```
111+
112+
---
113+
114+
115+
Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.39.0) for the contents of the release.

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.47.1"
7+
__version__ = "2.47.2"
88
__url__ = "https://github.com/DefectDojo/django-DefectDojo"
99
__docs__ = "https://documentation.defectdojo.com"

dojo/jira_link/helper.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,19 +1674,24 @@ def process_resolution_from_jira(finding, resolution_id, resolution_name, assign
16741674
jira_instance = get_jira_instance(finding)
16751675

16761676
if resolved:
1677-
if jira_instance and resolution_name in jira_instance.accepted_resolutions:
1677+
if jira_instance and resolution_name in jira_instance.accepted_resolutions and (finding.test.engagement.product.enable_simple_risk_acceptance or finding.test.engagement.enable_full_risk_acceptance):
16781678
if not finding.risk_accepted:
1679-
logger.debug(f"Marking related finding of {jira_issue.jira_key} as accepted. Creating risk acceptance.")
1679+
logger.debug(f"Marking related finding of {jira_issue.jira_key} as accepted.")
1680+
finding.risk_accepted = True
16801681
finding.active = False
16811682
finding.mitigated = None
16821683
finding.is_mitigated = False
16831684
finding.false_p = False
1684-
ra = Risk_Acceptance.objects.create(
1685-
accepted_by=assignee_name,
1686-
owner=finding.reporter,
1687-
)
1688-
finding.test.engagement.risk_acceptance.add(ra)
1689-
ra_helper.add_findings_to_risk_acceptance(User.objects.get_or_create(username="JIRA")[0], ra, [finding])
1685+
1686+
if finding.test.engagement.product.enable_full_risk_acceptance:
1687+
logger.debug(f"Creating risk acceptance for finding linked to {jira_issue.jira_key}.")
1688+
ra = Risk_Acceptance.objects.create(
1689+
accepted_by=assignee_name,
1690+
owner=finding.reporter,
1691+
decision_details=f"Risk Acceptance automatically created from JIRA issue {jira_issue.jira_key} with resolution {resolution_name}",
1692+
)
1693+
finding.test.engagement.risk_acceptance.add(ra)
1694+
ra_helper.add_findings_to_risk_acceptance(User.objects.get_or_create(username="JIRA")[0], ra, [finding])
16901695
status_changed = True
16911696
elif jira_instance and resolution_name in jira_instance.false_positive_resolutions:
16921697
if not finding.false_p:

dojo/metrics/views.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ def simple_metrics(request):
185185
total_medium = []
186186
total_low = []
187187
total_info = []
188-
total_closed = []
189188
total_opened = []
190189
findings_broken_out = {}
191190

@@ -197,10 +196,20 @@ def simple_metrics(request):
197196
date__year=now.year,
198197
)
199198

199+
closed = Finding.objects.filter(test__engagement__product__prod_type=pt,
200+
false_p=False,
201+
duplicate=False,
202+
out_of_scope=False,
203+
mitigated__month=now.month,
204+
mitigated__year=now.year,
205+
)
206+
200207
if get_system_setting("enforce_verified_status", True) or get_system_setting("enforce_verified_status_metrics", True):
201208
total = total.filter(verified=True)
209+
closed = closed.filter(verified=True)
202210

203211
total = total.distinct()
212+
closed = closed.distinct()
204213

205214
for f in total:
206215
if f.severity == "Critical":
@@ -214,9 +223,6 @@ def simple_metrics(request):
214223
else:
215224
total_info.append(f)
216225

217-
if f.mitigated and f.mitigated.year == now.year and f.mitigated.month == now.month:
218-
total_closed.append(f)
219-
220226
if f.date.year == now.year and f.date.month == now.month:
221227
total_opened.append(f)
222228

@@ -228,7 +234,7 @@ def simple_metrics(request):
228234
findings_broken_out["S4"] = len(total_info)
229235

230236
findings_broken_out["Opened"] = len(total_opened)
231-
findings_broken_out["Closed"] = len(total_closed)
237+
findings_broken_out["Closed"] = len(closed)
232238

233239
findings_by_product_type[pt] = findings_broken_out
234240

dojo/settings/settings.dist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,10 +1827,12 @@ def saml2_attrib_map_format(din):
18271827
"ELA-": "https://www.freexian.com/lts/extended/updates/", # e.g. https://www.freexian.com/lts/extended/updates/ela-1387-1-erlang
18281828
"ELBA-": "https://linux.oracle.com/errata/&&.html", # e.g. https://linux.oracle.com/errata/ELBA-2024-7457.html
18291829
"ELSA-": "https://linux.oracle.com/errata/&&.html", # e.g. https://linux.oracle.com/errata/ELSA-2024-12714.html
1830+
"EUVD-": "https://euvd.enisa.europa.eu/vulnerability/", # e.g. https://euvd.enisa.europa.eu/vulnerability/EUVD-2025-17599
18301831
"FEDORA-": "https://bodhi.fedoraproject.org/updates/", # e.g. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2024-06aa7dc422
18311832
"FG-IR-": "https://www.fortiguard.com/psirt/", # e.g. https://www.fortiguard.com/psirt/FG-IR-24-373
18321833
"GHSA-": "https://github.com/advisories/", # e.g. https://github.com/advisories/GHSA-58vj-cv5w-v4v6
18331834
"GLSA": "https://security.gentoo.org/", # e.g. https://security.gentoo.org/glsa/202409-32
1835+
"GO-": "https://pkg.go.dev/vuln/", # e.g. https://pkg.go.dev/vuln/GO-2025-3703
18341836
"JSDSERVER-": "https://jira.atlassian.com/browse/", # e.g. https://jira.atlassian.com/browse/JSDSERVER-14872
18351837
"KB": "https://support.hcl-software.com/csm?id=kb_article&sysparm_article=", # e.g. https://support.hcl-software.com/csm?id=kb_article&sysparm_article=KB0108401
18361838
"KHV": "https://avd.aquasec.com/misconfig/kubernetes/", # e.g. https://avd.aquasec.com/misconfig/kubernetes/khv045

dojo/tools/nmap/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ def get_findings(self, file, test):
4343
if host.find("hostnames/hostname[@type='PTR']") is not None
4444
else None
4545
)
46-
if fqdn is not None:
47-
host_info += f"**FQDN:** {fqdn}\n"
46+
for hosts in host.find("hostnames"):
47+
host_info += "**" + hosts.attrib["type"] + ":** " + hosts.attrib["name"] + "\n"
4848

4949
host_info += "\n\n"
50-
5150
for os in host.iter("os"):
5251
for os_match in os.iter("osmatch"):
5352
if "name" in os_match.attrib:

helm/defectdojo/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v2
2-
appVersion: "2.47.1"
2+
appVersion: "2.47.2"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.6.191
5+
version: 1.6.192
66
icon: https://www.defectdojo.org/img/favicon.ico
77
maintainers:
88
- name: madchap

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cryptography==45.0.3
3636
python-dateutil==2.9.0.post0
3737
pytz==2025.1
3838
redis==5.2.1
39-
requests==2.32.3
39+
requests==2.32.4
4040
sqlalchemy==2.0.41 # Required by Celery broker transport
4141
urllib3==2.4.0
4242
uWSGI==2.0.29
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
{"database":{"advisory-count":302,"last-commit":"7e4cbf6107145306ebb5002d66bcb98606a757fe","last-updated":"2021-05-12T01:59:58Z"},"lockfile":{"dependency-count":1},"settings":{"target_arch":null,"target_os":null,"severity":null,"ignore":[],"informational_warnings":["unmaintained"],"package_scope":null},"vulnerabilities":{"found":false,"count":0,"list":[]},"warnings":{}}
1+
{
2+
"database": {
3+
"advisory-count": 302,
4+
"last-commit": "7e4cbf6107145306ebb5002d66bcb98606a757fe",
5+
"last-updated": "2021-05-12T01:59:58Z"
6+
},
7+
"lockfile": {
8+
"dependency-count": 1
9+
},
10+
"settings": {
11+
"target_arch": null,
12+
"target_os": null,
13+
"severity": null,
14+
"ignore": [],
15+
"informational_warnings": [
16+
"unmaintained"
17+
],
18+
"package_scope": null
19+
},
20+
"vulnerabilities": {
21+
"found": false,
22+
"count": 0,
23+
"list": []
24+
},
25+
"warnings": {}
26+
}

0 commit comments

Comments
 (0)