Skip to content

🐛 fix create questionnaire with empty survey#13717

Closed
manuel-sommer wants to merge 60 commits intoDefectDojo:bugfixfrom
manuel-sommer:fix_questionnaireg
Closed

🐛 fix create questionnaire with empty survey#13717
manuel-sommer wants to merge 60 commits intoDefectDojo:bugfixfrom
manuel-sommer:fix_questionnaireg

Conversation

@manuel-sommer
Copy link
Copy Markdown
Contributor

@manuel-sommer manuel-sommer commented Nov 17, 2025

nginx-1         | 172.18.0.1 - - [17/Nov/2025:14:37:32 +0000] "GET /empty_questionnaire HTTP/1.1" 200 8573 "http://localhost:8080/questionnaire" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0" "-"
nginx-1         | 172.18.0.1 - - [17/Nov/2025:14:37:32 +0000] "GET /static/dojo/img/favicon.png HTTP/1.1" 200 243 "http://localhost:8080/empty_questionnaire" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0" "-"
uwsgi-1         | [17/Nov/2025 14:37:37] DEBUG [dojo.middleware:71] Authenticated user:
uwsgi-1         | [17/Nov/2025 14:37:37] ERROR [dojo.middleware:104] Unhandled exception during social login: DateTimeField General_Survey.expiration received a naive datetime (2025-11-19 00:00:00) while time zone support is active.
uwsgi-1         | [17/Nov/2025 14:37:37] ERROR [django.request:253] Internal Server Error: /empty_questionnaire
uwsgi-1         | Traceback (most recent call last):
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
uwsgi-1         |     response = get_response(request)
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/core/handlers/base.py", line 197, in _get_response
uwsgi-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
uwsgi-1         |   File "/app/dojo/authorization/authorization_decorators.py", line 63, in _wrapped
uwsgi-1         |     return func(request, *args, **kwargs)
uwsgi-1         |   File "/app/dojo/survey/views.py", line 621, in add_empty_questionnaire
uwsgi-1         |     if form.is_valid():
uwsgi-1         |        ~~~~~~~~~~~~~^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/forms/forms.py", line 197, in is_valid
uwsgi-1         |     return self.is_bound and not self.errors
uwsgi-1         |                                  ^^^^^^^^^^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/forms/forms.py", line 192, in errors
uwsgi-1         |     self.full_clean()
uwsgi-1         |     ~~~~~~~~~~~~~~~^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/forms/forms.py", line 327, in full_clean
uwsgi-1         |     self._post_clean()
uwsgi-1         |     ~~~~~~~~~~~~~~~~^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/forms/models.py", line 498, in _post_clean
uwsgi-1         |     self.instance.full_clean(exclude=exclude, validate_unique=False)
uwsgi-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/db/models/base.py", line 1619, in full_clean
uwsgi-1         |     self.clean_fields(exclude=exclude)
uwsgi-1         |     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/db/models/base.py", line 1674, in clean_fields
uwsgi-1         |     setattr(self, f.attname, f.clean(raw_value, self))
uwsgi-1         |                              ~~~~~~~^^^^^^^^^^^^^^^^^
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/db/models/fields/__init__.py", line 830, in clean
uwsgi-1         |     value = self.to_python(value)
uwsgi-1         |   File "/usr/local/lib/python3.13/site-packages/django/db/models/fields/__init__.py", line 1606, in to_python
uwsgi-1         |     warnings.warn(
uwsgi-1         |     ~~~~~~~~~~~~~^
uwsgi-1         |         f"DateTimeField {name} received a naive datetime ({value}) while "
uwsgi-1         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1         |         "time zone support is active.",
uwsgi-1         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1         |         RuntimeWarning,
uwsgi-1         |         ^^^^^^^^^^^^^^^
uwsgi-1         |     )
uwsgi-1         |     ^
uwsgi-1         | RuntimeWarning: DateTimeField General_Survey.expiration received a naive datetime (2025-11-19 00:00:00) while time zone support is active.

DefectDojo release bot and others added 30 commits November 3, 2025 19:14
….52.0-2.53.0-dev

Release: Merge back 2.52.0 into dev from: master-into-dev/2.52.0-2.53.0-dev
…v41.168.6 (.github/workflows/renovate.yaml) (DefectDojo#13584)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
….19.0 (docker-compose.override.dev.yml) (DefectDojo#13585)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…v41.169.2 (.github/workflows/renovate.yaml) (DefectDojo#13594)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…3600)

Bumps [drf-spectacular](https://github.com/tfranzel/drf-spectacular) from 0.28.0 to 0.29.0.
- [Release notes](https://github.com/tfranzel/drf-spectacular/releases)
- [Changelog](https://github.com/tfranzel/drf-spectacular/blob/master/CHANGELOG.rst)
- [Commits](tfranzel/drf-spectacular@0.28.0...0.29.0)

---
updated-dependencies:
- dependency-name: drf-spectacular
  dependency-version: 0.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps openapitools/openapi-generator-cli from v7.16.0 to v7.17.0.

---
updated-dependencies:
- dependency-name: openapitools/openapi-generator-cli
  dependency-version: v7.17.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…efectDojo#13598)

Bumps nginx from 1.29.2-alpine3.22 to 1.29.3-alpine3.22.

---
updated-dependencies:
- dependency-name: nginx
  dependency-version: 1.29.3-alpine3.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.9 to 3.10.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md)
- [Commits](Python-Markdown/markdown@3.9.0...3.10.0)

---
updated-dependencies:
- dependency-name: markdown
  dependency-version: '3.10'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [boto3](https://github.com/boto/boto3) from 1.40.63 to 1.40.65.
- [Release notes](https://github.com/boto/boto3/releases)
- [Commits](boto/boto3@1.40.63...1.40.65)

---
updated-dependencies:
- dependency-name: boto3
  dependency-version: 1.40.65
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…v41.169.4 (.github/workflows/renovate.yaml) (DefectDojo#13607)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…v1.34.1 (.github/workflows/k8s-tests.yml) (DefectDojo#13603)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…age.json) (DefectDojo#13604)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* implement n0s1 scanner DefectDojo#13564

* update

* ruff

* update

* update

* update

* underline the correctness through comparison with rustyhog
…v41.170.0 (.github/workflows/renovate.yaml) (DefectDojo#13615)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…fectDojo#12922)

* 🎉 Advance reimport to update fix_available field DefectDojo#12633

* docs

* update

* Update using_reimport.md

* implement a fixed version

* rebase fix

* Update dojo/models.py

Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>

* Update default_reimporter.py

* add unittests and grype

* update

* add unittests

* ruff

* update

* sync migration

* rebase

* update according to comment

* update according to rebase

* update

* update

* Clarify reimport behavior for findings update

Reimport will update existing findings 'fix_available' and 'fix_version' fields based on the incoming scan report.

* update

---------

Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
…Dojo#13573)

* Made file changes to test in dojo pro

* Changed logic so that individual findings are pushed to jira only after the groups association is confirmed

* Apply suggestion from @Maffooch

* Rerecord tests

---------

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
…2.8.0 (.github/workflows/test-helm-chart.yml) (DefectDojo#13629)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [boto3](https://github.com/boto/boto3) from 1.40.65 to 1.40.66.
- [Release notes](https://github.com/boto/boto3/releases)
- [Commits](boto/boto3@1.40.65...1.40.66)

---
updated-dependencies:
- dependency-name: boto3
  dependency-version: 1.40.66
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ge.json) (DefectDojo#13625)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…v41.173.0 (.github/workflows/renovate.yaml) (DefectDojo#13622)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…/package.json) (DefectDojo#13617)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…s/package.json) (DefectDojo#13616)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: kiblik <5609770+kiblik@users.noreply.github.com>
… when redirecting after login using social auth. (DefectDojo#13614)

* Adding SOCIAL_AUTH_REDIRECT_IS_HTTPS, to enable use of HTTPS protocol when redirecting after login.

* Adding description about how to setup SOCIAL_AUTH_REDIRECT_IS_HTTPS when using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).

* Adding description about how to setup SOCIAL_AUTH_REDIRECT_IS_HTTPS when using helm to docs (docs/content/en/customize_dojo/user_management/configure_sso.md).

* Apply suggestion from @valentijnscholten

---------

Co-authored-by: Marcel Horner <marcel.horner@stefanini.com>
Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
…v42 (.github/workflows/renovate.yaml) (DefectDojo#13638)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.14.3 to 0.14.4.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.14.3...0.14.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.14.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [boto3](https://github.com/boto/boto3) from 1.40.66 to 1.40.68.
- [Release notes](https://github.com/boto/boto3/releases)
- [Commits](boto/boto3@1.40.66...1.40.68)

---
updated-dependencies:
- dependency-name: boto3
  dependency-version: 1.40.68
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…e.json) (DefectDojo#13641)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [asteval](https://github.com/lmfit/asteval) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/lmfit/asteval/releases)
- [Commits](lmfit/asteval@1.0.6...1.0.7)

---
updated-dependencies:
- dependency-name: asteval
  dependency-version: 1.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
renovate Bot added 2 commits November 16, 2025 21:49
…ocker-compose.yml) (DefectDojo#13711)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…b/workflows/renovate.yaml) (DefectDojo#13712)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the New Migration Adding a new migration file. Take care when merging. label Nov 17, 2025
@manuel-sommer
Copy link
Copy Markdown
Contributor Author

@valentijnscholten please review

@manuel-sommer manuel-sommer marked this pull request as draft November 17, 2025 16:11
….52.2-2.53.0-dev

Release: Merge back 2.52.2 into dev from: master-into-dev/2.52.2-2.53.0-dev
@manuel-sommer manuel-sommer marked this pull request as ready for review November 17, 2025 16:24
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you base this against dev to reduce the chance of having to rebase migrations during merge back of a bugfix release?

@valentijnscholten valentijnscholten added this to the 2.53.0 milestone Nov 17, 2025
@github-actions github-actions Bot added docker settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR docs unittests ui parser helm conflicts-detected labels Nov 17, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Nov 17, 2025

DryRun Security

🔴 Risk threshold exceeded.

This pull request modifies several sensitive files (models, migrations, templates, Jira helper, importers) and introduces risks including excessive JIRA API calls when pushing finding groups, an IDOR in batch finding post-processing that skips per-user authorization, a management command that uses an unvalidated queue name (potential command argument injection/DoS), and a configurable dedupe batch size that could be weaponized to cause resource exhaustion.

🔴 Configured Codepaths Edit in dojo/db_migrations/0247_remove_finding_insert_insert_and_more.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/importers/default_reimporter.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/models.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/templates/dojo/view_finding.html
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/jira_link/helper.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
Excessive JIRA API Calls in dojo/jira_link/helper.py
Vulnerability Excessive JIRA API Calls
Description The push_finding_group_to_jira function now iterates over all findings within a group and calls update_jira_issue for each. This means that for a finding group with N findings, there will be N+1 calls to JIRA (N for individual findings and 1 for the group). If N is large, this can lead to an excessive number of API calls, potentially causing rate limiting or denial of service for the JIRA integration.

for finding in finding_group.findings.filter(jira_issue__isnull=False):
update_jira_issue(finding, *args, **kwargs)

Insecure Direct Object Reference (IDOR) in dojo/finding/helper.py
Vulnerability Insecure Direct Object Reference (IDOR)
Description The post_process_findings_batch function processes a list of finding_ids without verifying that the user (which defaults to None in the observed call sites) has the necessary permissions to access or modify each finding. The get_finding_models_for_deduplication function, called by post_process_findings_batch, fetches findings solely based on their IDs, without any user-specific authorization. This allows for unauthorized modification or access to findings if an attacker can control the finding_ids supplied to this batch processing function.

@dojo_async_task
@app.task
def post_process_findings_batch(finding_ids, *args, dedupe_option=True, rules_option=True, product_grading_option=True,
issue_updater_option=True, push_to_jira=False, user=None, **kwargs):

Potential Command Argument Injection in dojo/management/commands/clear_celery_queue.py
Vulnerability Potential Command Argument Injection
Description The clear_celery_queue management command takes a --queue argument directly from user input. This queue_name is then used without any validation or sanitization in Celery broker operations, specifically channel.queue_declare and channel.queue_purge. While management commands are typically run by trusted users, if this command were ever exposed to untrusted input, a malicious queue_name could potentially lead to a denial of service by purging unintended queues or causing errors in the Celery broker.

queue_name = options["queue"]
dry_run = options["dry_run"]
force = options["force"]

Potential Resource Exhaustion via Configuration in dojo/management/commands/dedupe.py
Vulnerability Potential Resource Exhaustion via Configuration
Description The IMPORT_REIMPORT_DEDUPE_BATCH_SIZE setting, which controls the batch size for deduplication tasks, can be configured to an arbitrarily low value (e.g., 1). While this setting is intended for administrators, if an attacker gains administrative access, they could set this value to 1. This would cause the system to create a large number of small tasks and perform many more database queries for deduplication, potentially leading to significant resource exhaustion and denial of service, especially in environments with a high volume of findings.

batch_max_size = getattr(settings, "IMPORT_REIMPORT_DEDUPE_BATCH_SIZE", 1000)
total_findings = findings_queryset.count()
logger.info(f"Processing {total_findings} findings in batches of max {batch_max_size} per test ({mode_str})")

We've notified @mtesauro.


All finding details can be found in the DryRun Security Dashboard.

@manuel-sommer manuel-sommer deleted the fix_questionnaireg branch November 17, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker docs helm New Migration Adding a new migration file. Take care when merging. parser settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR ui unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants