fix: use CSS custom property for timing bar width to bypass CSP blocking
Some checks failed
Build and Push Docker Image / build (push) Successful in 23s
CI / Security audit (push) Successful in 39s
CI / Tests & coverage (push) Failing after 35s

Inline style= attributes containing property:value pairs are blocked by
strict style-src-attr CSP. CSS custom properties (--foo:value) set via
style= are treated as data not styles and are not subject to this
restriction. The width is now resolved in the stylesheet via
var(--bar-w, 100%) so CSP cannot interfere.
This commit is contained in:
2026-05-17 08:55:06 +01:00
parent cafa608e8c
commit 67a8610843
2 changed files with 2 additions and 1 deletions

View File

@@ -710,7 +710,7 @@ function renderStatusPanel(data, panel) {
html += `
<div class="timing-row">
<span class="timing-label">${escapeHtml(t.label)}</span>
<div class="timing-bar-bg"><div class="timing-bar" style="width:${barWidth.toFixed(1)}%"></div></div>
<div class="timing-bar-bg"><div class="timing-bar" style="--bar-w:${barWidth.toFixed(1)}%"></div></div>
<span class="timing-value">${t.ms}ms</span>
</div>`;
}

View File

@@ -952,6 +952,7 @@ body {
.timing-bar {
height: 100%;
width: var(--bar-w, 100%);
background: var(--accent);
border-radius: 4px;
min-width: 2px;