Repository navigation
fix(search): show one total on the Simple Search Tagged tab - #17132
Conversation
The Tagged tab title was a bare positional list, "Tagged (0, 2, 12, 0, 0, 0)",
with nothing saying which number counted which type. The table inside listed
the types in a different order from that list, and "Tagged" was not
translatable.
- The view passes tagged_count, the total of the tagged result lists, and the
tab reads "Tagged (14)", like every other result tab.
- The table rows follow the page's tab order: findings, products,
engagements, tests, endpoints, finding templates.
- "Tagged" is wrapped in {% trans %} and translated in every catalog.
Closes DefectDojo#17129
Authored by T. Walker - DefectDojo
|
This pull request contains critical findings where the user 'skywalke34' modified sensitive codepaths in
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/simple_search.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'skywalke34' (commit e45de83) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/search/views.py (drs_d41110a1)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/search/views.py' matches configured sensitive codepath pattern 'dojo/search/*.py' and was modified by 'skywalke34' (commit e45de83) who is not in the allowed authors list. |
We've notified @mtesauro.
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.
Appending it at the end of every catalog collided with other PRs that also append there. Same entries, new position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Maffooch
left a comment
There was a problem hiding this comment.
Review: #17132 fix(search): show one total on the Simple Search Tagged tab
Verdict: approve
Head SHA reviewed: e0d3ade
Base: dev (milestone 3.6.0, correct)
Profile: code change (view + template + 28 .po catalogs + tests)
Summary
The Tagged tab now reads "Tagged (N)", where N is the sum of the six capped result lists. The rows follow the page's tab order, and "Tagged" is translatable. I confirmed live that the total matches the row count, the order is right, the query count is unchanged, and the translation renders.
Attempts
| # | What I did | Expected | Got | Result |
|---|---|---|---|---|
| 1 | Reverted simple_search.html, dojo/search/views.py and dojo/locale to origin/dev, ran unittests.test_simple_search_tagged_tab |
fail on dev, pass on PR | dev: tab and order tests fail plus the catalog test for all 28 languages; PR: 3/3 pass | no break |
| 2 | Live tag:revtag with 60 findings, 3 products, 1 engagement, 1 test |
one total equal to the rows | PR: "Tagged (65)", 65 rows. Dev: "Tagged (60, 3, 1, 1, 0, 0)" | no break |
| 3 | Row order in the Tagged table | Finding, Asset, Engagement, Test | PR: Finding, Asset, Engagement, Test. Dev: Test, Finding, Product, Engagement | no break |
| 4 | Query count for the same search, PR vs dev files (CaptureQueriesContext) |
no extra queries from the new sum(len(...)) |
91 vs 91 | no break |
| 5 | tagged_* are None on non-tag searches |
sum skips None |
guarded by if tagged (dojo/search/views.py:411-413); non-tag searches return 200 |
no break |
| 6 | msgfmt --check-format on all catalogs (PR alone and all five PRs merged), plus de/fr rendered |
no duplicate msgid; translated | 0 errors; "Getaggt (65)", "Étiquetés (65)" | no break |
| 7 | Merged with #17127 in both orders | clean, Product row keeps the label from #17127 | clean, identical trees, correct label on the moved row | no break |
| 8 | Hostile tag input (markup, 3000 chars) | 200, nothing reflected | 200, not reflected | no break |
Nice to have
- The comment on
dojo/search/views.py:410says each list is "already evaluated". They are sliced querysets. Theif taggedin the generator is what evaluates them, and the template then reuses the cached results. The behavior is right (attempt 4), but the comment could say that. - "Tagged" translations are machine-produced, as the PR notes.
Verified hands-on
Own compose stack with seeded tagged objects. Server-side renders in en/de/fr. Query counts measured on PR and dev files. New tests on the PR and with the fixed files reverted. Existing simple-search suites pass on the merged tree. ruff clean. CI green.
Static only / not reproduced
The V3_FEATURE_LOCATIONS=True path for tagged_endpoints (dojo/search/views.py:243) was not exercised. It is unchanged by this PR apart from being counted.
Description
Fixes #17129.
On Simple Search, a
tag:query shows a Tagged tab whose title is a bare list of six numbers, for example "Tagged (0, 2, 12, 0, 0, 0)". Nothing says which number counts which type. The table inside also listed the types in a different order from that list, and "Tagged" was not translatable.tagged_count, the total of the six tagged result lists, so the tab reads "Tagged (14)" like every other result tab. The per-type breakdown is the table's Type column. The lists are already evaluated (and capped atmax_results) by the time the total is taken, so this adds no queries.{% trans %}and added to every catalog. The translations are machine-produced (one word, aligned with each catalog's existing translation of "Tags") and would benefit from a native speaker's review.This touches the same template as #17127 but not the same lines; the two branches merge cleanly in either order.
Test results
unittests/test_simple_search_tagged_tab.py(3 tests). All 3 fail on currentdevand pass with this change:test_simple_search_tab_panes,test_simple_search_scoping,test_simple_search_bad_input): 11 tests OK in total.msgfmt.tag:complianceshows "Tagged (14)" next to "Products (2)" and "Engagements (12)", with 14 rows in the table.ruff checkpasses.Documentation
None needed (bug fix).
Checklist
dev.devbranch.Generated with Claude Code under the direction of T. Walker (skywalke34) - DefectDojo