Skip to content

fix(jira): gate the legacy endpoints block in the classic issue templates - #15810

Open
svader0 wants to merge 1 commit into
DefectDojo:bugfixfrom
svader0:fix/jira-github-classic-templates-v3-locations
Open

fix(jira): gate the legacy endpoints block in the classic issue templates#15810
svader0 wants to merge 1 commit into
DefectDojo:bugfixfrom
svader0:fix/jira-github-classic-templates-v3-locations

Conversation

@svader0

@svader0 svader0 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Description

When V3_FEATURE_LOCATIONS is on, pushing a finding to JIRA or GitHub returns a 500.

The JIRA description templates have two copies. The Tailwind copy under dojo/templates/issue-trackers/ got a {% if V3_FEATURE_LOCATIONS %} gate that renders finding.locations instead of finding.endpoints. The classic copy under dojo/templates_classic/issue-trackers/ did not. UIPreferenceLoader puts the classic tree first for every user who has not opted into the Tailwind UI, so the ungated copy is what most deployments render.

The ungated block does {% if finding.endpoints.all %}. A tenant migrated to Locations keeps its legacy Endpoint rows on purpose, so that queryset hydrates a deprecated Endpoint and Endpoint.__init__ raises NotImplementedError.

This PR copies the same gate into both classic templates:

  • dojo/templates_classic/issue-trackers/jira_full/jira-description.tpl
  • dojo/templates_classic/issue-trackers/jira_full/jira-finding-group-description.tpl

The group template gets it too. jira_description() renders that one for a finding-group push, and it carried the identical ungated block.

jira_description() and github_body() already pass V3_FEATURE_LOCATIONS into the context, so no Python change is needed.

Test results

Two tests in unittests/test_endpoint_init_v3.py already covered this and were failing:

  • TestEndpointInitV3.test_jira_description_renders_locations_under_v3
  • TestEndpointInitV3.test_github_body_renders_locations_under_v3

Before, with DD_V3_FEATURE_LOCATIONS=True:

Ran 2 tests
FAILED (errors=2)
NotImplementedError: Endpoint model is deprecated when V3_FEATURE_LOCATIONS is enabled
  File "dojo/jira/helper.py", line 765, in jira_description
    description = render_to_string(template, kwargs)
  ...
  File "django/template/defaulttags.py", line 326, in render
    if match:

After:

Ran 2 tests
OK

unittests/test_jira_helper.py still passes (47 tests). No test asserts the rendered description text, so nothing else changes.

Documentation

No documentation change. This restores the behavior the Locations docs already describe.

…ates

The V3 Locations gate was added to dojo/templates/issue-trackers only. The
classic copies under dojo/templates_classic/ kept the ungated
`{% if finding.endpoints.all %}`, and those are the copies the loader serves:
UIPreferenceLoader puts the classic tree first for every user who has not
opted into the Tailwind UI.

A migrated tenant keeps its legacy Endpoint rows, so rendering that block with
V3_FEATURE_LOCATIONS on hydrates a deprecated Endpoint and raises
NotImplementedError. Pushing such a finding to JIRA or GitHub returned a 500.

Both templates now carry the same gate the Tailwind copies already have. The
finding-group template gets it too, because jira_description renders that one
for a group push and it had the identical block.

Fixes the two pre-existing failures in
unittests/test_endpoint_init_v3.TestEndpointInitV3.
@svader0
svader0 requested a review from Maffooch as a code owner August 26, 2026 16:32
@svader0 svader0 added this to the 3.2.400 milestone Aug 26, 2026
@svader0
svader0 requested a review from blakeaowens as a code owner August 26, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant