Skip to content

Commit 43b9dac

Browse files
authored
Merge pull request #14250 from DefectDojo/master-into-dev/2.55.1-2.56.0-dev
Release: Merge back 2.55.1 into dev from: master-into-dev/2.55.1-2.56.0-dev
2 parents 8b3a5a3 + 0debd15 commit 43b9dac

File tree

13 files changed

+75
-21
lines changed

13 files changed

+75
-21
lines changed

docs/config/_default/hugo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ copyRight = "Copyright (c) 2020-2024 Thulite"
4646
priority = 0.5
4747

4848
[caches]
49+
[caches.getresource]
50+
dir = ":cacheDir/:project"
51+
maxAge = "1h"
4952
[caches.getjson]
5053
dir = ":cacheDir/:project"
51-
maxAge = -1 # "30m"
54+
maxAge = "1h"
5255

5356
[taxonomies]
5457
contributor = "contributors"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!-- Custom head -->
2-
{{ if site.Params.add_ons.docSearch -}}
2+
{{ if site.Params.add_ons.docSearch -}}
33
{{ $options := (dict "targetPath" "/css/main.min.css" "outputStyle" "compressed") }}
44
{{ $style := resources.Get "scss/app.scss" | css.Sass $options }}
5-
<link rel="stylesheet" href="{{ $style.Permalink }}">
5+
<link rel="stylesheet" href="{{ $style.Permalink }}">
66
{{ end -}}
7+
<meta name="docsearch:audience" content="{{ .Params.audience | default " public" }}">
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{- with .Params.seo.robots }}
2+
<meta name="robots" content="{{ . }}">
3+
{{- end }}

docs/layouts/robots.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
User-agent: *
2+
Disallow:
3+
Sitemap: {{ "/sitemap.xml" | absURL }}

dojo/api_v2/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ def notes(self, request, pk=None):
11241124
note_type=note_type,
11251125
)
11261126
note.save()
1127+
finding.last_reviewed = note.date
1128+
finding.last_reviewed_by = author
1129+
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
11271130
finding.notes.add(note)
11281131
# Determine if we need to send any notifications for user mentioned
11291132
process_tag_notifications(

dojo/jira_link/views.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ def check_for_and_create_comment(parsed_json):
285285
finding.notes.add(new_note)
286286
finding.jira_issue.jira_change = timezone.now()
287287
finding.jira_issue.save()
288-
# Only update the timestamp, not other fields like 'active' to avoid
288+
finding.last_reviewed = new_note.date
289+
finding.last_reviewed_by = author
290+
# Only update the timestamp fields, not other fields like 'active' to avoid
289291
# race conditions with concurrent webhook events (e.g. issue_updated)
290-
finding.save(update_fields=["updated"])
292+
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
291293
return None
292294

293295

@@ -345,11 +347,11 @@ def post(self, request):
345347
# Get the open and close keys
346348
msg = "Unable to find Open/Close ID's (invalid issue key specified?). They will need to be found manually"
347349
try:
350+
open_key = close_key = None
348351
issue_id = jform.cleaned_data.get("issue_key")
349352
key_url = jira_server.strip("/") + "/rest/api/latest/issue/" + issue_id + "/transitions?expand=transitions.fields"
350353
response = jira._session.get(key_url).json()
351354
logger.debug("Retrieved JIRA issue successfully")
352-
open_key = close_key = None
353355
for node in response["transitions"]:
354356
if node["to"]["statusCategory"]["name"] == "To Do":
355357
open_key = open_key or int(node["id"])

dojo/product_type/views.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from django.contrib import messages
55
from django.contrib.admin.utils import NestedObjects
66
from django.db import DEFAULT_DB_ALIAS
7-
from django.db.models import Count, IntegerField, OuterRef, Subquery, Value
7+
from django.db.models import OuterRef, Value
88
from django.db.models.functions import Coalesce
99
from django.db.models.query import QuerySet
1010
from django.http import HttpResponseRedirect
@@ -82,13 +82,10 @@ def prefetch_for_product_type(prod_types):
8282
logger.debug("unable to prefetch because query was already executed")
8383
return prod_types
8484

85-
prod_subquery = Subquery(
86-
Product.objects.filter(prod_type_id=OuterRef("pk"))
87-
.values("prod_type_id")
88-
.annotate(c=Count("*"))
89-
.values("c")[:1],
90-
output_field=IntegerField(),
91-
)
85+
prod_subquery = build_count_subquery(
86+
Product.objects.filter(prod_type_id=OuterRef("pk")),
87+
group_field="prod_type_id",
88+
)
9289
base_findings = Finding.objects.filter(test__engagement__product__prod_type_id=OuterRef("pk"))
9390
count_subquery = partial(build_count_subquery, group_field="test__engagement__product__prod_type_id")
9491

dojo/query_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
def build_count_subquery(model_qs: QuerySet, group_field: str) -> Subquery:
66
"""Return a Subquery that yields one aggregated count per `group_field`."""
7+
# Important: slicing (`[:1]`) on an unordered queryset makes Django add an implicit `ORDER BY <pk>`.
8+
# With aggregation, Django then includes that pk in the GROUP BY, which collapses counts to 1.
9+
# Ordering by `group_field` avoids that and keeps the GROUP BY stable.
10+
model_qs = model_qs.order_by()
711
return Subquery(
8-
model_qs.values(group_field).annotate(c=Count("*")).values("c")[:1], # one row per group_field
12+
model_qs.values(group_field).annotate(c=Count("pk")).order_by(group_field).values("c")[:1], # one row per group_field
913
output_field=IntegerField(),
1014
)

helm/defectdojo/Chart.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "2.56.0-dev"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.9.11-dev
5+
version: 1.9.12-dev
66
icon: https://defectdojo.com/hubfs/DefectDojo_favicon.png
77
maintainers:
88
- name: madchap
@@ -34,6 +34,4 @@ dependencies:
3434
# description: Critical bug
3535
annotations:
3636
artifacthub.io/prerelease: "true"
37-
artifacthub.io/changes: |
38-
- kind: added
39-
description: Valkey - use dedicated service account
37+
artifacthub.io/changes: ""

helm/defectdojo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ The HELM schema will be generated for you.
511511
512512
# General information about chart values
513513
514-
![Version: 1.9.11-dev](https://img.shields.io/badge/Version-1.9.11--dev-informational?style=flat-square) ![AppVersion: 2.56.0-dev](https://img.shields.io/badge/AppVersion-2.56.0--dev-informational?style=flat-square)
514+
![Version: 1.9.12-dev](https://img.shields.io/badge/Version-1.9.12--dev-informational?style=flat-square) ![AppVersion: 2.56.0-dev](https://img.shields.io/badge/AppVersion-2.56.0--dev-informational?style=flat-square)
515515
516516
A Helm chart for Kubernetes to install DefectDojo
517517

0 commit comments

Comments
 (0)