Repository navigation
fix(metrics): right-align numeric column headers to match their values - #17122
Conversation
Numeric cells in the metrics tables carry text-end, but their <th> cells did not, and `.table th` is left-aligned. Each header therefore sat at the opposite edge of the column from its numbers; on wide tables (Simple Metrics, Organization/Asset Tag Counts) every value read as belonging to the next column. Add text-end to the 108 headers whose column is right-aligned in simple_metrics.html, pt_counts.html and metrics.html. Text columns (Asset, Month, Title, ...) are unchanged. Authored by T. Walker - DefectDojo
|
This pull request contains critical security findings because the user 'skywalke34' modified sensitive HTML template files without being on the allowed authors list. Specifically, the files
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/metrics.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'skywalke34' (commit 60f14e6) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/pt_counts.html (drs_9681b62f)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/pt_counts.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'skywalke34' (commit 60f14e6) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/simple_metrics.html (drs_f795450d)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/simple_metrics.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'skywalke34' (commit 60f14e6) 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.
Maffooch
left a comment
There was a problem hiding this comment.
Review: #17122 fix(metrics): right-align numeric column headers to match their values
Verdict: approve
Head SHA reviewed: 60f14e6
Profile: code change (template classes + new unit test)
Base / milestone: dev, 3.6.0 (correct)
Gates
- ruff 0.16.10: all checks passed.
- CI: 40 of 40 pass.
- No model, settings or Helm change.
New test vs base
unittests.test_metrics_numeric_header_alignmenton the PR head: 3 tests OK.- With
metrics.html,pt_counts.htmlandsimple_metrics.htmlreverted toorigin/dev: all 3 fail, each listing the misaligned headers.
Break attempts
- Diff is only class attributes. I stripped
class="text-end"andclass="nowrap text-end"from the PR's three templates and diffed againstorigin/dev: identical. I counted 108 addedtext-endheaders, which matches the description. No break. - Over-alignment (the reverse of the PR's test). On rendered pages I checked every header/cell pair in both directions, for up to 3 body rows per table: a header marked
text-endabove a cell that is not, and atext-endcell under a header that is not. Pages: Simple Metrics (24 pairs), Organization Counts (66), Asset Tag Counts (66, a page the PR's test does not render), Organization Metrics (226), a single Organization's metrics page (226), and Critical Asset Metrics (no tables). On the PR: zero mismatches in either direction. Ondev: every numeric header is flagged. No break. - Shared template, second view.
pt_counts.htmlalso renders Asset Tag Counts. Covered in attempt 2 and clean. No break. - Interaction with #17124, which edits the same "No." row in
pt_counts.html.git merge-treeshows no conflict, and the combined tree passes all six new tests plus the existing metrics suites (35 OK, 2 skipped). No break. - Visual check. Browser on the combined tree at 1440px: Organization Counts headers sit over their numbers. No break.
Blocking
None.
Nice-to-haves
misaligned_headersin the new test skips tables whose header and first-row cell counts differ, and it only reads the first body row. That is fine for these templates, but a future table that uses colspan would be silently skipped. Thechecked > 0guard keeps the test from passing on an empty page.
Verified hands-on
Tests on the PR head and with the fix reverted. My two-way alignment check on six rendered pages on the PR and on dev. Browser view of Organization Counts.
Statically only
Tables that rendered no rows with the test data. The diff is class-only, so those can only gain a right-aligned header.
Could not reproduce
Nothing outstanding.
Description
The metrics tables right-align their numeric cells (
<td class="text-end">), but the matching<th>cells have no alignment class, and.table this left-aligned. Each header therefore sits at the opposite edge of its column from its numbers. Narrow tables hide it; on wide tables every number reads as belonging to the next column. On Simple Metrics, for example, "3485" (Total) sits under "Critical", and "33" (Critical) sits under "High". This predates the Tailwind rebuild: the i18n change only renamedtext-righttotext-end.The fix adds
text-endto the 108 headers whose column is right-aligned insimple_metrics.html,pt_counts.html(Organization and Asset Tag Counts) andmetrics.html(Organization Metrics). Text columns (Asset, Month, Title, ...) are unchanged. The diff touches only class attributes.Test results
unittests/test_metrics_numeric_header_alignment.py(3 tests). It parses every table on Simple Metrics, Organization Counts and Organization Metrics withlxmland requires that each header above atext-endcolumn also hastext-end. It also asserts that at least one numeric column was checked, so an empty page can't pass vacuously. All 3 fail on currentdevand pass with this change.ruff check/ruff format --check(0.16.10) pass.Documentation
None needed (bug fix).
Checklist
dev.devbranch.Generated with Claude Code under the direction of T. Walker (skywalke34) - DefectDojo