Skip to content

refactor: decouple Jira integration into dojo/jira package - #22

Closed
Maffooch wants to merge 41 commits into
devfrom
jira-cleanup
Closed

Maffooch wants to merge 41 commits into
devfrom
jira-cleanup

Conversation

@Maffooch

@Maffooch Maffooch commented Mar 31, 2026 •

Copy link
Copy Markdown
Owner

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.

Test results

Existing Jira unit tests (unittests/test_jira_*.py, unittests/test_importers_importer.py, unittests/test_rest_framework.py) were updated for the new import paths. No new tests added since there is no behavior change.

Documentation

No user-facing behavior changes — no docs update needed.

Checklist

  • Rebased against the very latest dev
  • Submitted against dev
  • Meaningful PR title
  • Ruff compliant
  • Python 3.13 compliant
  • N/A — no new user-facing feature
  • N/A — no model/schema changes, no migration
  • Unit test import paths updated for the new module layout
  • Label: maintenance

paulOsinski and others added 27 commits April 8, 2026 14:14
…x/2.57.1-2.58.0-dev

Release: Merge back 2.57.1 into bugfix from: master-into-bugfix/2.57.1-2.58.0-dev
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.1 to 12.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@12.1.1...12.2.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.2.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>
…er (DefectDojo#14631)

* added ssrf utils to check urls and applied it to risk recon parser

* update risk recon unit tests

* add unit tests for SSRF protection in risk recon API init

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* add unit tests for utils_ssrf module

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix accept_risks API endpoints to use RBAC instead of IsAdminUser

Replace DRF's IsAdminUser permission with DefectDojo's RBAC system
on all accept_risks endpoints. IsAdminUser only checked is_staff,
bypassing role-based access control entirely.

- Use UserHasRiskAcceptanceRelatedObjectPermission for detail endpoints
  (engagement/test accept_risks) to enforce Permissions.Risk_Acceptance
- Change mass endpoint to query engagements with Risk_Acceptance
  permission instead of Engagement_View
- Enforce product-level enable_full_risk_acceptance setting on all
  accept_risks endpoints
- Add 9 RBAC unit tests covering writer/reader roles and the
  enable_full_risk_acceptance product setting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix ruff lint: add blank line before class docstring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* change to reactivating risk accepted findinggs

* Fix remove_finding BFLA and add test coverage (PR DefectDojo#14633)

Gate the remove_finding POST branch on edit_mode so only the edit URL
(requiring Risk_Acceptance permission) can process finding removals.
Scope the finding lookup to risk_acceptance.accepted_findings to prevent
cross-product blind enumeration via sequential IDs.

Add 6 security tests covering: edit_mode guard, scoped lookup, cross-product
IDOR, decorator enforcement, and positive regression.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Dojo#14634)

* change-to-moving-engagements

* fix-migration-issue:

* Revert PR DefectDojo#14634 changes (editable=False approach)

Reverting the approach of making Engagement.product editable=False
and splitting serializers. Will replace with proper permission checks
on the destination product when moving engagements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add permission check on destination product when moving engagements

When a user changes an engagement's product (via API PUT/PATCH or
the UI edit form), verify they have Engagement_Edit permission on
the destination product. Previously only the source product was
checked, allowing users to move engagements to products they lack
write access to.

- API: EngagementSerializer.validate() checks destination product
  permission on update, following the ProductMemberSerializer pattern
- UI: edit_engagement() view checks destination product permission
  before saving
- Tests: 8 new tests covering PATCH, PUT, and UI paths for both
  authorized and unauthorized product moves

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix UI test: form queryset already rejects unauthorized products

The EngForm product queryset is filtered to authorized products, so
submitting an unauthorized product fails form validation (200) before
the view-level permission check runs. Update the test to accept both
200 and 403 -- the key assertion is that the engagement does not move.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix ruff lint: docstring formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documents a repeatable 10-phase process for reorganizing domain modules
(finding, test, engagement, product, product_type) to match the dojo/url/
reference pattern. Includes service-layer extraction guidance to support
the long-term goal of removing the classic UI and going fully API-based.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…#14682)

Remove unnecessary template filter from auditor and mitigated_by
fields in the endpoints snippet to align with standard Django
template rendering conventions.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mport/reimport (DefectDojo#14636)

* Fix reimport-scan API authorization bypass via conflicting identifiers

Validate that ID-resolved objects (test, engagement) are consistent with
name-based identifiers (product_name, engagement_name) in both the
permission check layer and the AutoCreateContextManager resolution layer.
This prevents an attacker from passing their own engagement/test ID to
satisfy the permission check while using name-based fields to target a
victim's product.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Use ID-based comparisons and add engagement_name check to import

- Switch permission checks to use ID comparisons (product_id, engagement_id)
  where resolved objects are available, with name fallback for unresolved cases
- Add engagement_name validation to UserHasImportPermission (was missing)
- Fix ruff string quoting in auto_create_context.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Strip undeclared engagement field in reimport permission check

The engagement field is not declared on ReImportScanSerializer and gets
stripped during validation. The permission check must also strip it so it
resolves targets the same way execution does — by name, not by a stale
engagement ID from request.data.

Update test to verify the engagement param is ignored and permission is
checked against the name-resolved target.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix information disclosure in conflict validation error messages

Replace error messages that leaked resolved object names (product names,
engagement names) with generic messages. An attacker could enumerate
object names by sending conflicting ID-based and name-based identifiers
and reading the detailed error responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Paul Osinski <42211303+paulOsinski@users.noreply.github.com>
🎉 add mozilla foundation sec advice to vulnid
…nization-playbook

docs: add CLAUDE.md with module reorganization playbook
…4708)

* Add OSS subscriber for Open Source Messaging banner

Fetches a markdown message from the DaaS-published GCS bucket, renders
the bleached headline and optional expanded section through the existing
additional_banners template loop. Cached for 1h; any fetch/parse failure
silently yields no banner. No Django settings introduced — disabling the
banner requires forking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Enable nl2br in expanded markdown and fold module into dojo.announcement

Single newlines in the expanded body now render as <br>, so authored
markdown lays out multi-line. Module folded into the existing
dojo/announcement/ app and test patch paths updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Use <button> for banner toggle and clean focus styling

Anchor-based toggle picked up Bootstrap alert link styles and a
lingering focus outline after click, which showed as a stray glyph next
to the caret. A plain <button type="button"> avoids link decoration
entirely; focus outline and transition are also dropped so the caret
flips instantly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Replace DD_CLOUD_BANNER with centralized additional_banners system

Migrate all promotional messaging to the additional_banners context
processor pattern. Product announcements now store banners in the
session for rendering via the unified template loop. Each banner
carries a source field (os, product_announcement) so downstream
repos can filter by origin.

- Remove DD_CREATE_CLOUD_BANNER setting and env var entirely
- Repurpose ProductAnnouncementManager to use session-based banners
- Remove evaluate_pro_proposition celery task and beat schedule
- Remove create_announcement_banner from initialization command
- Simplify announcement signal to remove cloud-specific logic
- Add SHOW_PLG_LINK context variable for PLG menu item control
- Rename os-banner-* CSS classes to generic banner-* classes
- Add data-source attribute to banner template markup
- Switch OS message bucket URL from dev to prod
- Add 52 tests covering context processor and product announcements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove unused import and add docstring to TestBannerDictSchema

* Fix ruff FURB189: use UserDict instead of dict subclass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Release: Merge release into master from: release/2.57.2
@Maffooch Maffooch changed the title Jira cleanup refactor: decouple Jira integration into dojo/jira package Apr 21, 2026
….57.2-2.58.0-dev

Release: Merge back 2.57.2 into dev from: master-into-dev/2.57.2-2.58.0-dev
@Maffooch Maffooch changed the title refactor: decouple Jira integration into dojo/jira package refactor: decouple Jira integration into dojo/jira package Apr 21, 2026
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.
renovate Bot and others added 11 commits April 22, 2026 10:04
…bot-renovate-43.x

Update dependency renovatebot/renovate from 43.112.1 to v43.139.4 (.github/workflows/renovate.yaml)
…ocker-compose.yml) (DefectDojo#14720)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…kerfile.nginx-alpine) (DefectDojo#14721)

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

Bumps [social-auth-core](https://github.com/python-social-auth/social-core) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/python-social-auth/social-core/releases)
- [Changelog](https://github.com/python-social-auth/social-core/blob/master/CHANGELOG.md)
- [Commits](python-social-auth/social-core@4.8.5...4.8.6)

---
updated-dependencies:
- dependency-name: social-auth-core
  dependency-version: 4.8.6
  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 [ruff](https://github.com/astral-sh/ruff) from 0.15.10 to 0.15.11.
- [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.15.10...0.15.11)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.11
  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>
…ckerfile.integration-tests-debian) (DefectDojo#14727)

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

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…lows/validate_docs_build.yml) (DefectDojo#14734)

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

* Update valkey Docker tag from 0.19.0 to v0.20.0 (helm/defectdojo/Chart.yaml)

* update Helm documentation

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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