Skip to content

refactor: decouple Jira integration into dojo/jira package#14743

Merged
Maffooch merged 4 commits intoDefectDojo:devfrom
Maffooch:jira-cleanup
Apr 24, 2026
Merged

refactor: decouple Jira integration into dojo/jira package#14743
Maffooch merged 4 commits intoDefectDojo:devfrom
Maffooch:jira-cleanup

Conversation

@Maffooch
Copy link
Copy Markdown
Contributor

Description

Extracts all Jira integration code into a dedicated dojo/jira package and introduces dojo/jira/services.py as the single entry point for the rest of the application. The goal is to remove direct coupling between core models/forms/views/importers and Jira internals so the Jira module can evolve without touching consumers across the codebase.

What changed:

  • Renamed dojo/jira_link/dojo/jira/ and added models.py, forms.py, and api/{serializers,views}.py to hold the Jira-specific pieces previously embedded in dojo/models.py, dojo/forms.py, and dojo/api_v2/.
  • New dojo/jira/services.py (service-layer module matching the services.py convention used elsewhere, e.g. dojo/engagement/services.py) exposing the public Jira surface consumed by non-Jira modules. Each wrapper is a one-line delegation to dojo.jira.helper, lazy-imported inside the module to break the import cycle between dojo.forms / dojo.models / dojo.utils and dojo.jira.helper. Real Jira errors propagate to callers instead of being swallowed.
  • Direct Jira imports removed from: dojo/models.py, dojo/forms.py, dojo/api_v2/{serializers,views}.py, dojo/finding/{helper,views}.py, dojo/finding_group/views.py, dojo/engagement/{services,views}.py, dojo/product/views.py, dojo/test/views.py, dojo/risk_acceptance/helper.py, dojo/templatetags/display_tags.py, dojo/importers/*, dojo/tasks.py, and dojo/utils.py (SLA notifications). Management commands (jira_async_updates, jira_refactor_data_migration, jira_status_reconciliation, push_to_jira_update) updated to import from the new package.
  • .dryrunsecurity.yaml sensitive-codepaths glob updated to track dojo/jira/**.

No behavior change is intended — this is a code-move / import-boundary cleanup. No DB schema changes and no new settings.

Introduce a new dojo/jira package (models, forms, api, helper, queries,
urls, views) and a top-level dojo/jira_facade.py. Route all Jira
references from the rest of the codebase (models.py properties, forms,
api_v2 serializers and views, view files, tasks, display_tags,
risk_acceptance/helper, finding/helper, importers, utils SLA
notifications, engagement/services, management commands) through the
facade so no module outside the Jira package imports Jira internals
directly.

Also resolves a circular import in dojo/jira/models.py, updates test
mock paths for the new module layout, and fixes ruff lint across the
moved files.
@Maffooch Maffooch requested a review from mtesauro as a code owner April 22, 2026 22:45
@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Apr 22, 2026

DryRun Security

This pull request may introduce mass-assignment risks: it unpacks request.data into dojo_dispatch_task(...) allowing clients to set arbitrary task kwargs, and it forwards entire HttpRequest objects into jira_services.process_project_form(...) (which only delegates to a helper), potentially enabling uncontrolled request data to reach model saves or forms unless the downstream helper explicitly allowlists/validates fields.

🔴 Potential Mass Assignment Vulnerability in dojo/api_v2/views.py (drs_08ca8880)
Vulnerability Potential Mass Assignment Vulnerability
Description The code calls dojo_dispatch_task(task, engagement.id, **request.data), expanding request.data into keyword args and forwarding them into a background task without explicit allowlisting or validation at the call site. This may allow a client to set arbitrary parameters that the task (or downstream code) accepts, matching the pattern for mass-assignment when request data is unpacked into function arguments.

dojo_dispatch_task(task, engagement.id, **request.data)
response = Response(
{"info": "Jira Epic update query sent"},
status=status.HTTP_200_OK,

🟠 Potential Mass Assignment Vulnerability in dojo/product/views.py (drs_3d4598e7)
Vulnerability Potential Mass Assignment Vulnerability
Description The code forwards the entire HttpRequest object into jira_services.process_project_form(request, ...). The new dojo.jira.services module is a thin wrapper that delegates to dojo.jira.helper.process_jira_project_form; the wrapper passes the same request object to the helper. Because process_project_form receives the full request, if the underlying helper applies request.POST (or request.data) directly to model.save() or ModelForm without explicit allowlisting, that could permit mass assignment. Inspecting the patch shows the new services wrapper does not itself perform field filtering or validation — it simply delegates to the helper — so the only mitigation would be inside dojo.jira.helper.process_jira_project_form (not included in the patch). Without proof that the helper uses a Django Form/Serializer or explicit allowlist, this is potentially dangerous.

success, jform = jira_services.process_project_form(request, instance=jira_project, product=product)
error = not success
if get_system_setting("enable_github") and github_inst:

We've notified @mtesauro.


Comment to provide feedback on these findings.

Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]

Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing

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

@Maffooch Maffooch added this to the 2.58.0 milestone Apr 23, 2026
Copy link
Copy Markdown
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

@github-actions
Copy link
Copy Markdown
Contributor

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

# Conflicts:
#	dojo/importers/default_reimporter.py
@github-actions
Copy link
Copy Markdown
Contributor

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

…merge

Stale leftover from a prior version of jira-cleanup; the file uses
jira_services.is_keep_in_sync directly and never references
FindingLocationStatus. Resolves the ruff-linting CI failure on
PR DefectDojo#14743 after merging upstream/dev.
@Maffooch Maffooch merged commit a200ad7 into DefectDojo:dev Apr 24, 2026
157 checks passed
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