Skip to content

fix 500 error on critical product metrics page - #14945

Merged
mtesauro merged 1 commit into
DefectDojo:bugfixfrom
valentijnscholten:fix/critical-product-metrics-crash
Jun 5, 2026
Merged

fix 500 error on critical product metrics page#14945
mtesauro merged 1 commit into
DefectDojo:bugfixfrom
valentijnscholten:fix/critical-product-metrics-crash

Conversation

@valentijnscholten

Copy link
Copy Markdown
Member

Summary

  • critical_product_metrics view renders metrics.html without a form context variable
  • Django resolves undefined template variables as empty string ""
  • filter_snippet.html calls {% get_filter_groups form %} unconditionally, which crashes with AttributeError: 'str' object has no attribute 'visible_fields'
  • Fix: wrap the filter_snippet.html include in {% if form %} in both metrics.html and metrics_classic/metrics.html
  • The filter UI was already intentionally hidden for this view (filter button guarded by {% if not critical_prods %}); the filter content div just wasn't guarded

Fixes #14944

…late

critical_product_metrics view renders metrics.html without a form context
variable. Django resolves undefined template vars as empty string, causing
get_filter_groups to crash with AttributeError on str.visible_fields().

Wrapping the filter_snippet include in {% if form %} prevents the crash.
Fixes DefectDojo#14944.
@github-actions github-actions Bot added the ui label Jun 2, 2026
@valentijnscholten valentijnscholten added this to the 2.59.1 milestone Jun 2, 2026
@valentijnscholten valentijnscholten changed the title fix: guard filter snippet include when no form in metrics template fix error on critical product metrics page Jun 2, 2026
@valentijnscholten valentijnscholten changed the title fix error on critical product metrics page fix 500 error on critical product metrics page Jun 2, 2026

@mtesauro mtesauro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved

@mtesauro
mtesauro removed the request for review from Maffooch June 4, 2026 05:39
@mtesauro
mtesauro merged commit 51f9261 into DefectDojo:bugfix Jun 5, 2026
147 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants