fix(vulnerabilities): restore severity colors and constrain long targets

This commit is contained in:
Sycun 2026-11-13 16:24:08 +08:00
parent a125d749e7
commit 76e9df9b0c
8 changed files with 74 additions and 25 deletions

View File

@ -52,7 +52,6 @@
font-weight: 650;
font-variant-numeric: tabular-nums;
margin: 6px 0 2px;
color: var(--text-primary);
}
#page-vulnerabilities .stat-label { font-size: 12px; color: var(--text-secondary); }
@ -65,6 +64,46 @@
#page-vulnerabilities .vulnerability-host-option { padding: 10px 8px; }
#page-vulnerabilities .vulnerability-host-option[aria-pressed="true"] { background: color-mix(in srgb,var(--accent-color) 9%,transparent); }
#page-vulnerabilities .vulnerability-domain-branch > .vulnerability-host-option { padding-inline-start: 22px; }
#page-vulnerabilities .vulnerability-host-option-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.vulnerability-domain-label {
display: inline-block;
max-width: calc(100% - 54px);
padding: 0;
border: 0;
background: transparent;
color: var(--text-primary);
font: inherit;
text-align: start;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
}
.vulnerability-domain-label[aria-pressed="true"] { color: var(--accent-color); font-weight: 600; }
.vulnerability-host-heading-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.vulnerability-host-heading-actions [hidden] { display: none; }
#page-vulnerabilities .vulnerability-host-results-heading { align-items: start; }
#vulnerability-host-selection {
min-width: 0;
flex: 1 1 180px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.vulnerability-table-name {
flex: 1;
min-width: 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
#page-vulnerabilities .vulnerability-host-overview { min-height: 36px; margin-bottom: 12px; }
#page-vulnerabilities .vulnerability-host-results-heading h3 { font-size: 16px; font-weight: 600; }
#page-vulnerabilities .vulnerability-host-table { min-width: 880px; font-size: 13px; }
@ -131,7 +170,7 @@
}
.vulnerability-inspector-header .modal-close { position: static; flex-shrink: 0; }
.vulnerability-inspector-eyebrow { color: var(--text-muted); font-size: 12px; }
.vulnerability-inspector-header h2 { font-size: 21px; line-height: 1.5; margin: 6px 0 0; overflow-wrap: anywhere; }
.vulnerability-inspector-header h2 { font-size: 21px; line-height: 1.5; margin: 6px 0 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
#vulnerability-inspector-body { padding: 20px 28px 32px; overflow-y: auto; flex: 1; }
.vulnerability-inspector-meta,
.vulnerability-inspector-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
@ -141,12 +180,15 @@
.vulnerability-inspector-tabs button[aria-pressed="true"] { color: var(--accent-color); border-bottom-color: var(--accent-color); font-weight: 600; }
[data-inspector-panel][hidden] { display: none; }
[data-inspector-panel] h3 { margin: 24px 0 12px; font-size: 14px; }
.vulnerability-inspector-description { white-space: pre-wrap; line-height: 1.8; font-size: 14px; }
.vulnerability-inspector-description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 14px; }
.vulnerability-target-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.vulnerability-target-list li { display: flex; flex-direction: column; gap: 5px; padding: 13px 16px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); overflow-wrap: anywhere; }
.vulnerability-target-list li:last-child { border-bottom: 0; }
.vulnerability-target-list strong { font-size: 13px; }
.vulnerability-target-list code { font-size: 12px; color: var(--text-secondary); white-space: pre-wrap; }
.vulnerability-target-list code { display: block; max-width: 100%; max-height: 96px; overflow: auto; font-size: 12px; color: var(--text-secondary); white-space: pre; }
.vulnerability-target-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vulnerability-target-heading strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vulnerability-target-heading button { flex-shrink: 0; font-size: 12px; }
.vulnerability-timeline { list-style: none; padding: 0 0 0 16px; border-inline-start: 1px solid var(--border-color); margin: 0; }
.vulnerability-timeline-event { position: relative; padding: 0 0 24px 12px; }
.vulnerability-timeline-event::before { content: ''; position: absolute; left: -21px; top: 5px; width: 8px; height: 8px; background: var(--accent-color); border-radius: 50%; }

View File

@ -2751,9 +2751,9 @@
"noHistory": "لا يوجد سجل منظم بعد",
"exportVisibleHosts": "تصدير النتائج المعروضة",
"tableDownload": "تنزيل",
"pageAllHosts": "جميع مضيفي هذه الصفحة",
"allHosts": "جميع المضيفين",
"clearHostSelection": "مسح مرشح المضيف",
"hostSearch": "البحث في جميع المضيفين…",
"domainAll": "جميع مضيفي النطاق في هذه الصفحة",
"tableSeverity": "الخطورة",
"tableTitle": "اسم الثغرة",
"tableStatus": "الحالة",

View File

@ -2894,9 +2894,9 @@
"noHistory": "No structured history yet",
"exportVisibleHosts": "Export displayed findings",
"tableDownload": "Download",
"pageAllHosts": "All hosts on this page",
"allHosts": "All hosts",
"clearHostSelection": "Clear host filter",
"hostSearch": "Search all hosts…",
"domainAll": "All hosts in this domain on this page",
"tableSeverity": "Severity",
"tableTitle": "Finding",
"tableStatus": "Status",

View File

@ -2907,9 +2907,9 @@
"noHistory": "Структурированной истории пока нет",
"exportVisibleHosts": "Экспорт показанных записей",
"tableDownload": "Скачать",
"pageAllHosts": "Все хосты на странице",
"allHosts": "Все хосты",
"clearHostSelection": "Сбросить фильтр хостов",
"hostSearch": "Поиск по всем хостам…",
"domainAll": "Все хосты домена на странице",
"tableSeverity": "Критичность",
"tableTitle": "Уязвимость",
"tableStatus": "Статус",

View File

@ -2882,9 +2882,9 @@
"noHistory": "暂无结构化处置记录",
"exportVisibleHosts": "导出右侧列表",
"tableDownload": "下载",
"pageAllHosts": "本页全部域名",
"allHosts": "全部域名",
"clearHostSelection": "清除域名筛选",
"hostSearch": "搜索全部域名…",
"domainAll": "本页该域名下全部主机",
"tableSeverity": "严重度",
"tableTitle": "漏洞名称",
"tableStatus": "状态",

View File

@ -117,10 +117,12 @@ async function openVulnerabilityInspector(id) {
if (request !== vulnerabilityInspectorRequest) return;
const v = context.vulnerability;
title.textContent = v.title;
title.title = v.title;
const jsID = escapeJsStringAttr(v.id);
const targets = (v.targets || []).map(target => `
<li><strong>${escapeHtml(target.host)}</strong>
<code>${escapeHtml([target.scheme, target.port, target.path].filter(Boolean).join(' · ') || target.raw)}</code>
<li><div class="vulnerability-target-heading"><strong title="${escapeAttr(target.host)}">${escapeHtml(target.host)}</strong>
<button type="button" class="btn-ghost" data-target="${escapeAttr(target.raw)}" onclick="vulnerabilityCopyEncoded(event,encodeURIComponent(this.dataset.target))">${escapeHtml(vulnT('common.copy'))}</button></div>
<code tabindex="0" title="${escapeAttr(target.raw)}">${escapeHtml(target.raw)}</code>
</li>`).join('');
const history = (context.history || []).map(event => `
<li class="vulnerability-timeline-event">

View File

@ -1539,7 +1539,7 @@ function renderVulnerabilityHostBrowser(vulnerabilities, opts) {
}
const button = (key, label, count, items = []) => `
<button type="button" class="vulnerability-host-option" data-host-key="${escapeAttr(key)}" aria-pressed="false">
<span class="vulnerability-host-option-name">${renderVulnerabilityHostRiskDot(items)}${escapeHtml(label)}</span><span class="vulnerability-host-number">${count}</span>
<span class="vulnerability-host-option-name" title="${escapeAttr(label)}">${renderVulnerabilityHostRiskDot(items)}${escapeHtml(label)}</span><span class="vulnerability-host-number">${count}</span>
</button>`;
const tree = Array.from(domains, ([domain, hosts]) => {
const count = new Set(vulnerabilities.filter(vuln => (vuln.target_domain || vuln.target_host || '') === domain).map(vuln => vuln.id)).size;
@ -1549,8 +1549,7 @@ function renderVulnerabilityHostBrowser(vulnerabilities, opts) {
}
const open = opts.hostOpenStates?.get(domain) ?? true;
return `<details class="vulnerability-domain-branch" data-domain="${escapeAttr(domain)}"${open ? ' open' : ''}>
<summary>${escapeHtml(domain)} <span class="vulnerability-host-number">${count}</span></summary>
${button('domain:' + domain, vulnT('vulnerabilityPage.domainAll'), count)}
<summary><button type="button" class="vulnerability-domain-label" data-host-key="domain:${escapeAttr(domain)}" title="${escapeAttr(domain)}" aria-pressed="false">${escapeHtml(domain)}</button><span class="vulnerability-host-number">${count}</span></summary>
${Array.from(hosts, ([host, n]) => button('host:' + host, host, n,
vulnerabilities.filter(vuln => (vuln.target_host || '') === host))).join('')}
</details>`;
@ -1563,14 +1562,16 @@ function renderVulnerabilityHostBrowser(vulnerabilities, opts) {
aria-label="${escapeAttr(vulnT('vulnerabilityPage.hostSearch'))}"
placeholder="${escapeAttr(vulnT('vulnerabilityPage.hostSearch'))}" value="${escapeAttr(vulnerabilityHostQuery)}">
<nav class="vulnerability-host-tree">
${button('', vulnT('vulnerabilityPage.pageAllHosts'), new Set(vulnerabilities.map(vuln => vuln.id)).size)}
${tree}
</nav>
</aside>
<section class="vulnerability-host-results">
<div class="vulnerability-host-results-heading">
<h3 id="vulnerability-host-selection"></h3>
<span id="vulnerability-host-selection-count"></span>
<div class="vulnerability-host-heading-actions">
<button type="button" id="vulnerability-host-clear" class="btn-ghost" onclick="vulnerabilityHostSelection='';renderVulnerabilityHostTable()" hidden>${escapeHtml(vulnT('vulnerabilityPage.clearHostSelection'))}</button>
<span id="vulnerability-host-selection-count"></span>
</div>
</div>
<div class="vulnerability-host-overview">
<div id="vulnerability-host-risk-summary"></div>
@ -1594,6 +1595,7 @@ function renderVulnerabilityHostBrowser(vulnerabilities, opts) {
list.querySelector('.vulnerability-host-tree').addEventListener('click', event => {
const option = event.target.closest('button[data-host-key]');
if (!option) return;
event.preventDefault();
vulnerabilityHostSelection = option.dataset.hostKey;
renderVulnerabilityHostTable();
});
@ -1643,8 +1645,11 @@ function renderVulnerabilityHostTable(expandedIds) {
document.querySelectorAll('#vulnerabilities-list [data-host-key]').forEach(option => {
option.setAttribute('aria-pressed', String(option.dataset.hostKey === selection));
});
const label = selection ? selection.slice(selection.indexOf(':') + 1) : vulnT('vulnerabilityPage.pageAllHosts');
document.getElementById('vulnerability-host-selection').textContent = label || vulnT('vulnerabilityPage.unknownHost');
const label = selection ? selection.slice(selection.indexOf(':') + 1) : vulnT('vulnerabilityPage.allHosts');
const heading = document.getElementById('vulnerability-host-selection');
heading.textContent = label || vulnT('vulnerabilityPage.unknownHost');
heading.title = heading.textContent;
document.getElementById('vulnerability-host-clear').hidden = !selection;
document.getElementById('vulnerability-host-selection-count').textContent =
vulnT('vulnerabilityPage.groupPageCount', { count: items.length });
const counts = {};
@ -1689,7 +1694,7 @@ function renderVulnerabilityTableItem(vuln) {
<button type="button" id="vulnerability-row-toggle-${id}" class="vulnerability-row-toggle"
aria-expanded="false" aria-controls="content-${id}" onclick="${vuln.summary_only ? 'openVulnerabilityInspector' : 'toggleVulnerabilityDetails'}(${jsID})">
<span id="expand-icon-${id}" class="vulnerability-row-caret" aria-hidden="true">›</span>
<span>${escapeHtml(vuln.title)}</span>
<span class="vulnerability-table-name" title="${escapeAttr(vuln.title)}">${escapeHtml(vuln.title)}</span>
</button>
<p>${escapeHtml((vuln.description || '').slice(0, 160))}</p>
${vuln.case_id ? `<span class="vulnerability-case-badge">${escapeHtml(vulnT('vulnerabilityPage.mergedRecord'))}</span>` : ''}

View File

@ -48,7 +48,7 @@
<link rel="stylesheet" href="/static/vendor/xterm.css">
<!-- 移动端样式层:全部规则限定在 767.98px 以下,桌面端零影响 -->
<link rel="stylesheet" href="/static/css/mobile.css?v=20261015-project-table-3">
<link rel="stylesheet" href="/static/css/vulnerability-workspace.css?v=20261113-workspace">
<link rel="stylesheet" href="/static/css/vulnerability-workspace.css?v=20261113-long-targets">
<script src="/static/js/router.js?v=20261011-token-settings"></script>
</head>
<body>
@ -7136,8 +7136,8 @@
<script src="/static/js/skills.js?v=20261103-personal-integration"></script>
<script src="/static/js/fact-graph.js"></script>
<script src="/static/js/projects.js?v=20260819-1-pagination-20261027"></script>
<script src="/static/js/vulnerability.js?v=20261113-vulnerability-workspace"></script>
<script src="/static/js/vulnerability-workspace.js?v=20261113-workspace"></script>
<script src="/static/js/vulnerability.js?v=20261113-domain-labels"></script>
<script src="/static/js/vulnerability-workspace.js?v=20261113-long-targets"></script>
<script src="/static/js/vulnerability-download.js?v=20261030-2"></script>
<script src="/static/js/webshell.js?v=20261011-token-usage-tool-title"></script>
<script src="/static/js/chat-files.js?v=20261103-personal-integration"></script>