Skip to content

Commit c9f34c2

Browse files
Merge branch 'dev' into rm_testtypesfrompages
2 parents 82f8a27 + 6f7f691 commit c9f34c2

File tree

12 files changed

+72
-29
lines changed

12 files changed

+72
-29
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ jobs:
114114
- name: Update values in HELM chart
115115
if: startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'dependabot/')
116116
run: |
117-
yq -i '.annotations."artifacthub.io/changes" += "- kind: changed\n description: ${{ github.event.pull_request.title }}\n"' helm/defectdojo/Chart.yaml
117+
title=${{ github.event.pull_request.title }}
118+
chars='{}:[],&*#?|-<>=!%@'
119+
for c in $(echo "$chars" | grep -o .); do
120+
title="${title//"$c"/_}"
121+
done
122+
yq -i '.annotations."artifacthub.io/changes" += "- kind: changed\n description: $title\n"' helm/defectdojo/Chart.yaml
118123
git add helm/defectdojo/Chart.yaml
119124
git commit -m "ci: update Chart annotations from PR #${{ github.event.pull_request.number }}" || echo "No changes to commit"
120125

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.53.0-dev",
3+
"version": "2.54.0-dev",
44
"license" : "BSD-3-Clause",
55
"private": true,
66
"dependencies": {

docker/entrypoint-uwsgi.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ python3 manage.py check
2727

2828
DD_UWSGI_LOGFORMAT_DEFAULT='[pid: %(pid)|app: -|req: -/-] %(addr) (%(dd_user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core))'
2929

30-
EXTRA_ARGS=""
30+
DD_UWSGI_EXTRA_ARGS="${DD_UWSGI_EXTRA_ARGS:-}"
3131
if [ -n "${DD_UWSGI_MAX_FD}" ]; then
32-
EXTRA_ARGS="${EXTRA_ARGS} --max-fd ${DD_UWSGI_MAX_FD}"
32+
DD_UWSGI_EXTRA_ARGS="${DD_UWSGI_EXTRA_ARGS} --max-fd ${DD_UWSGI_MAX_FD}"
3333
fi
3434

3535
exec uwsgi \
@@ -42,5 +42,5 @@ exec uwsgi \
4242
--buffer-size="${DD_UWSGI_BUFFER_SIZE:-8192}" \
4343
--http 0.0.0.0:8081 --http-to "${DD_UWSGI_ENDPOINT}" \
4444
--logformat "${DD_UWSGI_LOGFORMAT:-$DD_UWSGI_LOGFORMAT_DEFAULT}" \
45-
$EXTRA_ARGS
45+
$DD_UWSGI_EXTRA_ARGS
4646
# HTTP endpoint is enabled for Kubernetes liveness checks. It should not be exposed as a service.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ description: Dropped support for DD_PARSER_EXCLUDE
88
To simplify the management of the DefectDojo application, parser exclusions are no longer controlled via the environment variable DD_PARSER_EXCLUDE or application settings. This variable is now unsupported.
99
From now on, you should use the active flag in the Test_Type model to enable or disable parsers. Only parsers associated with active Test_Type entries will be available for use.
1010

11-
There are other instructions for upgrading to 2.54.x. Check the Release Notes for the contents of the release.
11+
There are other instructions for upgrading to 2.54.x. Check the Release Notes for the contents of the release.

docs/content/en/share_your_findings/troubleshooting_jira.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,34 @@ To correct this issue, you can add the 'Epic Name' field to your Project's issue
101101

102102
![image](images/epic_name_error.png)
103103

104+
## Configuring JIRA Connection Retries and Timeouts
105+
106+
DefectDojo's JIRA integration includes configurable retry and timeout settings to handle rate limiting and connection issues. These settings are important for maintaining system responsiveness, especially when using Celery workers.
107+
108+
### Available Configuration Variables
109+
110+
The following environment variables control JIRA connection behavior:
111+
112+
- **`DD_JIRA_MAX_RETRIES`** (default: `3`): Maximum number of retry attempts for recoverable errors. The integration will automatically retry on HTTP 429 (Too Many Requests), HTTP 503 (Service Unavailable), and connection errors. See the [JIRA rate limiting documentation](https://developer.atlassian.com/cloud/jira/platform/rate-limiting/) for more information.
113+
114+
- **`DD_JIRA_CONNECT_TIMEOUT`** (default: `10` seconds): Connection timeout for establishing a connection to the JIRA server.
115+
116+
- **`DD_JIRA_READ_TIMEOUT`** (default: `30` seconds): Read timeout for waiting for a response from the JIRA server after the connection is established.
117+
118+
**Note on Rate Limiting**: The jira library has a built-in maximum wait time of 60 seconds for rate limiting retries. If JIRA's `Retry-After` header indicates a wait time longer than 60 seconds, the request will fail and not be retried. This is a limitation of the jira library version currently in use.
119+
120+
### Why Conservative Values Matter
121+
122+
**Important**: It is recommended to use conservative (lower) values for these settings. Here's why:
123+
124+
1. **Celery Task Blocking**: JIRA operations in DefectDojo run as asynchronous Celery tasks. When a task is waiting for a retry delay, it blocks that Celery worker from processing other tasks.
125+
126+
2. **Worker Pool Exhaustion**: If multiple JIRA operations are retrying with long delays, you can quickly exhaust your Celery worker pool, causing other tasks (not just JIRA-related) to queue up and wait.
127+
128+
3. **System Responsiveness**: Long retry delays can make the system appear unresponsive, especially during JIRA outages or rate limiting events.
129+
130+
JIRA Rate limiting is new, so please let us know on Slack or GitHub what works best for you.
131+
104132
## Jira and DefectDojo are out of sync
105133

106134
Sometimes Jira is down, or DefectDojo is down, or there was bug in a webhook. In this case, Jira can become out of sync with DefectDojo. If this is the case for lots of issues, manual reconciliation might not be feasible. For this scenario there is the management command 'jira_status_reconciliation'.

docs/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"thulite": "2.6.3"
2727
},
2828
"devDependencies": {
29-
"prettier": "3.7.2",
29+
"prettier": "3.7.3",
3030
"vite": "7.2.4"
3131
},
3232
"engines": {

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

dojo/jira_link/helper.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def can_be_pushed_to_jira(obj, form=None):
208208
return False, f"Finding below the minimum JIRA severity threshold ({System_Settings.objects.get().jira_minimum_severity}).", "error_below_minimum_threshold"
209209
elif isinstance(obj, Finding_Group):
210210
finding_group_status = _safely_get_obj_status_for_jira(obj)
211-
logger.error("Finding group status: %s", finding_group_status)
212211
if "Empty" in finding_group_status:
213212
return False, f"{to_str_typed(obj)} cannot be pushed to jira as it contains no findings above minimum treshold.", "error_empty"
214213

@@ -433,14 +432,19 @@ def has_jira_configured(obj):
433432

434433

435434
def connect_to_jira(jira_server, jira_username, jira_password):
435+
max_retries = getattr(settings, "JIRA_MAX_RETRIES", 3)
436+
timeout = getattr(settings, "JIRA_TIMEOUT", (10, 30))
437+
436438
return JIRA(
437439
server=jira_server,
438440
basic_auth=(jira_username, jira_password),
439-
max_retries=0,
441+
max_retries=max_retries,
442+
timeout=timeout,
440443
options={
441444
"verify": settings.JIRA_SSL_VERIFY,
442445
"headers": settings.ADDITIONAL_HEADERS,
443-
})
446+
},
447+
)
444448

445449

446450
def get_jira_connect_method():

dojo/settings/settings.dist.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@
250250
# When interacting with jira tickets that attached finding groups, we should no be opening any findings
251251
# on the DefectDojo side because jira has no way of knowing if a finding really should be reopened or not
252252
DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN=(bool, False),
253+
# JIRA connection retry and timeout settings: https://developer.atlassian.com/cloud/jira/platform/rate-limiting/
254+
# Maximum number of retry attempts for recoverable errors (429, 503, ConnectionError)
255+
# See https://jira.readthedocs.io/ for more in the jira library used by DefectDojo
256+
# Note: The jira library has a built-in maximum wait time of 60s for rate limiting retries.
257+
# If JIRA's Retry-After header indicates a wait time longer than 60s, the request will fail and not be retried.
258+
DD_JIRA_MAX_RETRIES=(int, 3),
259+
# Connection timeout (seconds) for establishing a connection to the JIRA server
260+
DD_JIRA_CONNECT_TIMEOUT=(int, 10),
261+
# Read timeout (seconds) for waiting for a response from the JIRA server
262+
DD_JIRA_READ_TIMEOUT=(int, 30),
253263
# You can set extra Jira issue types via a simple env var that supports a csv format, like "Work Item,Vulnerability"
254264
DD_JIRA_EXTRA_ISSUE_TYPES=(str, ""),
255265
# if you want to keep logging to the console but in json format, change this here to 'json_console'
@@ -1722,6 +1732,12 @@ def saml2_attrib_map_format(din):
17221732
JIRA_SSL_VERIFY = env("DD_JIRA_SSL_VERIFY")
17231733
JIRA_DESCRIPTION_MAX_LENGTH = env("DD_JIRA_DESCRIPTION_MAX_LENGTH")
17241734
JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN = env("DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN")
1735+
# JIRA connection retry and timeout settings
1736+
JIRA_MAX_RETRIES = env("DD_JIRA_MAX_RETRIES")
1737+
JIRA_CONNECT_TIMEOUT = env("DD_JIRA_CONNECT_TIMEOUT")
1738+
JIRA_READ_TIMEOUT = env("DD_JIRA_READ_TIMEOUT")
1739+
# Combine timeouts into a tuple for the JIRA library: (connect_timeout, read_timeout)
1740+
JIRA_TIMEOUT = (JIRA_CONNECT_TIMEOUT, JIRA_READ_TIMEOUT)
17251741

17261742
# ------------------------------------------------------------------------------
17271743
# LOGGING

0 commit comments

Comments
 (0)