Skip to content

fix 500 error on critical product metrics page#14945

Open
valentijnscholten wants to merge 1 commit into
DefectDojo:bugfixfrom
valentijnscholten:fix/critical-product-metrics-crash
Open

fix 500 error on critical product metrics page#14945
valentijnscholten wants to merge 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
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

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.

3 participants