Skip to content

Conversation

@kiblik
Copy link
Contributor

@kiblik kiblik commented Oct 16, 2025

If functions are not only for private use, they should not use a private naming convention. Applies to:

  • _get_prefetchable_fields
  • _copy_model_util

Regarding from hyperlink._url import SCHEME_PORT_MAP, there is no known better alternative.

@dryrunsecurity
Copy link

DryRun Security

This pull request introduces model copy utilities that by default duplicate all fields and lack built-in authorization checks, so sensitive fields (credentials, PII, internal details) can be unintentionally copied and users with read access might create full copies they shouldn’t be able to, leading to potential information disclosure and access-control bypass.

Information Disclosure via Model Copying in dojo/models.py
Vulnerability Information Disclosure via Model Copying
Description The copy_model_util function, when called without specifying exclude_fields, copies all fields from a model instance to a new one. Several copy methods in dojo/models.py use this utility without excluding potentially sensitive fields. This means that if a model contains sensitive data (e.g., internal network details, credentials, PII), this data will be duplicated into the new instance. If the copied instance is then accessible to unauthorized users or users with lower privileges, it can lead to information disclosure.

def copy_model_util(model_in_database, exclude_fields: list[str] | None = None):
if exclude_fields is None:
exclude_fields = []
new_model_instance = model_in_database.__class__()

Missing Authorization Checks in Model Copy Operations in dojo/models.py
Vulnerability Missing Authorization Checks in Model Copy Operations
Description The copy_model_util function and the model-specific copy methods that utilize it (e.g., for NoteHistory, Engagement, Finding) do not include any authorization checks. This means that if these copy methods are invoked from any part of the application without explicit, robust authorization checks at the call site, a user could potentially bypass access controls. A user with read access to an object might be able to create a full copy of it, gaining ownership or access to data they were not authorized to create or fully access in the original context.

def copy_model_util(model_in_database, exclude_fields: list[str] | None = None):
if exclude_fields is None:
exclude_fields = []
new_model_instance = model_in_database.__class__()


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

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

@Maffooch Maffooch merged commit 4e1b4c6 into DefectDojo:dev Oct 17, 2025
148 checks passed
@kiblik kiblik deleted the ruff/PLC branch October 17, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants