Skip to content

Fix multiselect filter fields not being initialized as Select2 - #16306

Merged
Maffooch merged 3 commits into
DefectDojo:devfrom
raedbrahem:fix/filter-select2-htmx
Oct 17, 2026
Merged

Maffooch merged 3 commits into
DefectDojo:devfrom
raedbrahem:fix/filter-select2-htmx

Conversation

@raedbrahem

@raedbrahem raedbrahem commented Oct 12, 2026 •

Copy link
Copy Markdown

Description

Fixes #16110.

On the Findings list (and every other page using filter_snippet.html), multiselect filter fields such as "Locations Status", "Severity" or "Test Type" rendered as native, unstyled <select multiple> elements clipped to a single visible option row, instead of Select2 widgets.

Root cause: the Select2 initialization in dojo/templates/dojo/filter_js_snippet.html only targets .similar-filters select[multiple], and .similar-filters exists solely on the similar-findings panel in view_finding.html. All other filter panels never had their multiselects initialized. The one-row clipping comes from .dojo-filter-set .form-control { height: 2.125rem } winning over the select[multiple] rule, which only sets min-height/max-height. (The htmx hypothesis in the issue is not the cause: the filter panel is rendered server-side, not swapped in by htmx.)

The design-system CSS for .dojo-filter-set .select2-container and the clear-filters logic for select.select2-hidden-accessible already exist in dojo.css / filter_snippet.html, so Select2 was clearly intended here; this PR just wires it up.

Changes:

  • filter_js_snippet.html: initialize Select2 on .dojo-filter-set select[multiple] (keeping .similar-filters), skipping tagulous widgets (they initialize themselves) and already-initialized fields (the snippet can be included more than once on a page). Guarded on $.fn.select2, because Select2 is only loaded through the tagulous form media and is absent on filter pages without tag fields (e.g. /endpoint, /user).
  • dojo.css: height: auto on .dojo-filter-set select[multiple] so that, on pages where Select2 is not available, the native control shows its options instead of a single clipped row.

Test results

Verified on the dev docker compose stack with a headless Chrome script:

  • Before: on /finding, all 12 non-tag multiselect filters (id_location_status, id_severity, id_test__test_type, ...) had no select2-hidden-accessible class and were 34px tall. After: all 12 are Select2 widgets with search and dropdown, "Locations Status" shows Active / Mitigated / False Positive / Risk Accepted / Out Of Scope.
  • Swept /finding, /finding/open, /product, /engagement, /metrics, /endpoint, /user, /test_type, /tool_type: no JS errors; on pages with Select2 every multiselect has exactly one .select2-container (no double init); on pages without Select2 the native multiselect now renders at ~80px with its options visible.
  • Clear button still resets the Select2 fields (existing select.select2-hidden-accessible handling).

No Python changes, so no unit tests added; happy to add a Selenium check in tests/ if maintainers would like one.

Documentation

No documentation changes needed (UI bug fix).

The Select2 initialization in filter_js_snippet.html only targeted
'.similar-filters select[multiple]', a class that exists solely on the
similar-findings panel of the finding view. Every other filter panel
(findings list, products, engagements, metrics, ...) rendered its
multiselect filters as native <select multiple> elements, and the fixed
height set by '.dojo-filter-set .form-control' clipped them to a single
visible option row.

- Initialize Select2 on all '.dojo-filter-set select[multiple]' fields,
  skipping tagulous widgets (which initialize themselves) and fields
  that are already initialized (the snippet can be included more than
  once on a page).
- Guard on $.fn.select2, since Select2 is only loaded through the
  tagulous form media and is absent on filter pages without tag fields.
- Let native multiselects grow (height: auto) so pages without Select2
  still show a usable list instead of a single clipped row.

Fixes DefectDojo#16110

Co-authored-by: Cursor <cursoragent@cursor.com>
@dryrunsecurity

dryrunsecurity Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

DryRun Security

This pull request modifies several sensitive codepaths, including templates, authentication, and database migrations, using authors who are not on the allowed list. These changes are flagged as low severity and are not blocking.

Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/filter_js_snippet.html (drs_47792588)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/templates/dojo/filter_js_snippet.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by '' (commit 7ece1a4) who is not in the allowed authors list.
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/apps.py (drs_8a88b1f8)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/apps.py' matches configured sensitive codepath pattern 'dojo/apps.py' and was modified by 'raedbrahem' (commit a21f226) who is not in the allowed authors list.
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/api_permissions.py (drs_78a4b617)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/authorization/api_permissions.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'raedbrahem' (commit a21f226) who is not in the allowed authors list.
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/user/authentication.py (drs_fd5b83d1)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/user/authentication.py' matches configured sensitive codepath pattern 'dojo/user/*.py' and was modified by 'raedbrahem' (commit a21f226) who is not in the allowed authors list.
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/db_migrations/0299_finding_test_numsev_index.py (drs_96ae656e)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/db_migrations/0299_finding_test_numsev_index.py' matches configured sensitive codepath pattern 'dojo/db_migrations/*.py' and was modified by 'raedbrahem' (commit 2130ec1) who is not in the allowed authors list.
Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/finding/models.py (drs_2ed4cf0a)
Vulnerability Configured Sensitive Codepath Modified by Non-Allowed Author
Description File 'dojo/finding/models.py' matches configured sensitive codepath pattern 'dojo/finding/*.py' and was modified by 'raedbrahem' (commit 2130ec1) who is not in the allowed authors list.

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 pull request to the merge queue Oct 17, 2026
@Maffooch Maffooch added this to the 3.4.200 milestone Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@Maffooch
Maffooch added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@Maffooch
Maffooch added this pull request to the merge queue Oct 17, 2026
Merged via the queue into DefectDojo:dev with commit a7c4d21 Oct 17, 2026
48 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.

4 participants