@skyhook-io/radar-app 1.22.2 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +49 -13
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +151 -27
  9. package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
  10. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  11. package/src/api/diagnose.ts +4 -0
  12. package/src/api/kagent.test.ts +82 -0
  13. package/src/api/kagent.ts +230 -0
  14. package/src/api/poll.ts +78 -0
  15. package/src/api/prometheusCharts.ts +5 -0
  16. package/src/api/radarFeatures.test.ts +9 -0
  17. package/src/api/radarFeatures.ts +16 -0
  18. package/src/api/substrateWorkspace.test.ts +72 -0
  19. package/src/api/substrateWorkspace.ts +1394 -0
  20. package/src/api/vulnerabilities.ts +207 -9
  21. package/src/api/workloadSource.test.tsx +315 -0
  22. package/src/api/workloadSource.ts +128 -12
  23. package/src/components/CloudConnectFlow.tsx +46 -7
  24. package/src/components/CloudFunnelButton.test.tsx +193 -7
  25. package/src/components/CloudFunnelButton.tsx +128 -32
  26. package/src/components/SelfManagedStart.tsx +12 -2
  27. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  28. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  29. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  30. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  31. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  32. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  33. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  34. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  35. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  36. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  37. package/src/components/agentsandbox/data.ts +135 -0
  38. package/src/components/agentsandbox/host.test.ts +27 -0
  39. package/src/components/agentsandbox/host.tsx +85 -0
  40. package/src/components/agentsandbox/labels.test.ts +42 -0
  41. package/src/components/agentsandbox/labels.ts +146 -0
  42. package/src/components/agentsandbox/listFilters.ts +85 -0
  43. package/src/components/agentsandbox/lists.ts +52 -0
  44. package/src/components/agentsandbox/routes.ts +23 -0
  45. package/src/components/agentsandbox/shared.tsx +321 -0
  46. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  47. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  48. package/src/components/agentsandbox/workspace.tsx +258 -0
  49. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  50. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  51. package/src/components/applications/ApplicationsView.tsx +156 -3
  52. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  53. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  54. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  55. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  56. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  57. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  58. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  59. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  60. package/src/components/cloudHints/cloudHints.ts +131 -0
  61. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  62. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  63. package/src/components/cloudHints/cloudLinks.ts +31 -0
  64. package/src/components/cloudHints/hintStorage.ts +28 -0
  65. package/src/components/cnpg/CNPGView.tsx +4 -7
  66. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  67. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  68. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  69. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  70. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  71. package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
  72. package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
  73. package/src/components/helm/HelmView.tsx +4 -3
  74. package/src/components/helm/ObservedHelmNotice.tsx +39 -17
  75. package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
  76. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
  77. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
  78. package/src/components/home/HomeAgentBlock.tsx +2 -0
  79. package/src/components/home/HomeView.tsx +3 -3
  80. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  81. package/src/components/home/MCPSetupDialog.tsx +6 -2
  82. package/src/components/home/McpCloudLine.test.tsx +162 -0
  83. package/src/components/home/McpCloudLine.tsx +95 -0
  84. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  85. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  86. package/src/components/home/mcpToolCatalog.ts +4 -4
  87. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  88. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  89. package/src/components/issues/IssuesPane.tsx +181 -23
  90. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  91. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  92. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  93. package/src/components/issues/sinceLastVisit.ts +439 -0
  94. package/src/components/issues/uncheckedSources.test.ts +8 -0
  95. package/src/components/issues/uncheckedSources.ts +3 -0
  96. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  97. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  98. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  99. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  100. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  101. package/src/components/kagent/KagentLists.tsx +412 -0
  102. package/src/components/kagent/KagentOverview.tsx +234 -0
  103. package/src/components/kagent/KagentPages.tsx +690 -0
  104. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  105. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  106. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  107. package/src/components/kagent/KagentView.tsx +109 -0
  108. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  109. package/src/components/kagent/host.tsx +144 -0
  110. package/src/components/kagent/routes.ts +31 -0
  111. package/src/components/kagent/shared.tsx +336 -0
  112. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  113. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  114. package/src/components/kagent/workspace.fixtures.ts +108 -0
  115. package/src/components/kagent/workspaceRoute.ts +18 -0
  116. package/src/components/nudges/activeNudges.test.ts +39 -0
  117. package/src/components/nudges/activeNudges.ts +76 -0
  118. package/src/components/poll/OssPoll.tsx +871 -0
  119. package/src/components/poll/mount.test.ts +12 -0
  120. package/src/components/poll/pollCloud.test.ts +23 -0
  121. package/src/components/poll/pollCloud.ts +6 -0
  122. package/src/components/poll/pollDefinition.ts +93 -0
  123. package/src/components/poll/pollFlow.test.ts +140 -0
  124. package/src/components/poll/pollFlow.ts +137 -0
  125. package/src/components/poll/pollSender.test.ts +137 -0
  126. package/src/components/poll/pollSender.ts +76 -0
  127. package/src/components/poll/pollStorage.test.ts +53 -0
  128. package/src/components/poll/pollStorage.ts +77 -0
  129. package/src/components/poll/round.json +350 -0
  130. package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
  131. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  132. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  133. package/src/components/resource/PrometheusCharts.tsx +10 -1
  134. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  135. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  136. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  137. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  138. package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
  139. package/src/components/resources/ImageFilesystemModal.tsx +42 -3
  140. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  141. package/src/components/resources/ResourcesView.tsx +24 -11
  142. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  143. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  144. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  145. package/src/components/settings/SettingsDialog.tsx +84 -16
  146. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  147. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  148. package/src/components/settings/SubstrateSettings.tsx +544 -0
  149. package/src/components/settings/settings-state.test.ts +21 -3
  150. package/src/components/settings/settings-state.ts +13 -3
  151. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  152. package/src/components/share/ShareLinkButton.tsx +391 -0
  153. package/src/components/share/openShareInCloud.test.ts +29 -0
  154. package/src/components/share/openShareInCloud.ts +10 -0
  155. package/src/components/share/shareLink.test.ts +129 -0
  156. package/src/components/share/shareLink.ts +175 -0
  157. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  158. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  159. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  160. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  161. package/src/components/substrate/SubstrateActors.tsx +612 -0
  162. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  163. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  164. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  165. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  166. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  167. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  168. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  169. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  170. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  171. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  172. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  173. package/src/components/substrate/SubstrateView.tsx +173 -0
  174. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  175. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  176. package/src/components/substrate/attention.ts +81 -0
  177. package/src/components/substrate/contextPin.tsx +69 -0
  178. package/src/components/substrate/host.tsx +83 -0
  179. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  180. package/src/components/substrate/readings.test.ts +484 -0
  181. package/src/components/substrate/readings.ts +997 -0
  182. package/src/components/substrate/routes.ts +103 -0
  183. package/src/components/substrate/shared.tsx +426 -0
  184. package/src/components/substrate/substrate.fixtures.ts +325 -0
  185. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  186. package/src/components/substrate/workspaceRoute.ts +23 -0
  187. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  188. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  189. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  190. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  191. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  192. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  193. package/src/components/traffic/TrafficGraph.tsx +17 -14
  194. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  195. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  196. package/src/components/traffic/TrafficView.tsx +26 -56
  197. package/src/components/traffic/trafficFilters.test.ts +61 -1
  198. package/src/components/traffic/trafficFilters.ts +68 -8
  199. package/src/components/ui/UpdateNotification.tsx +2 -0
  200. package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
  201. package/src/components/velero/VeleroOverview.tsx +2 -2
  202. package/src/components/velero/VeleroView.tsx +3 -6
  203. package/src/components/vulnerabilities/columns.tsx +132 -0
  204. package/src/components/vulnerabilities/filters.tsx +317 -0
  205. package/src/components/vulnerabilities/owner.test.ts +54 -0
  206. package/src/components/vulnerabilities/owner.tsx +163 -0
  207. package/src/components/vulnerabilities/parts.test.ts +126 -12
  208. package/src/components/vulnerabilities/parts.tsx +612 -52
  209. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  210. package/src/components/vulnerabilities/traffic.tsx +40 -0
  211. package/src/components/whats-new/WhatsNew.tsx +2 -0
  212. package/src/components/whats-new/releaseNotes.ts +75 -1
  213. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  214. package/src/components/workload/WorkloadView.tsx +52 -13
  215. package/src/components/workspace/layout.tsx +13 -7
  216. package/src/components/workspace/sidebar.test.ts +48 -0
  217. package/src/components/workspace/sidebar.ts +73 -3
  218. package/src/components/workspace/table.ts +2 -1
  219. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  220. package/src/contexts/RegistryAccessMode.tsx +25 -0
  221. package/src/integrations/resourceHost.ts +12 -6
  222. package/src/integrations/resourceHosts.test.tsx +27 -1
  223. package/src/integrations/resourceHosts.tsx +15 -7
  224. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  225. package/src/integrations/sidebarWorkspaces.ts +41 -0
  226. package/src/integrations/workspaceRoute.ts +1 -1
  227. package/src/integrations/workspaceRoutes.ts +7 -1
  228. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -1,4 +1,4 @@
1
- import { useState } from 'react'
1
+ import { useId, useRef, useState } from 'react'
2
2
  import { useMutation } from '@tanstack/react-query'
3
3
  import { WithTooltip } from '../ui/Tooltip'
4
4
  import { useSearchParams } from 'react-router-dom'
@@ -13,23 +13,24 @@ import {
13
13
  PageHeader,
14
14
  PaneLoader,
15
15
  RadarUpgradeAction,
16
+ RadarUpgradeNote,
16
17
  radarUpgradeDetail,
17
18
  radarUpgradeHeadline,
18
19
  useDebouncedValue,
19
20
  useDisclosure,
20
- VULN_SEVERITY_TEXT,
21
21
  VULN_SEVERITY_BAR,
22
22
  DistributionBar,
23
- DistributionLegendChip,
24
23
  FilterPill,
25
24
  Input,
26
25
  RowActionMenu,
26
+ type RowActionItem,
27
27
  } from '@skyhook-io/k8s-ui'
28
28
  import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
29
29
  import { formatRelativeAgeTime } from '@skyhook-io/k8s-ui/utils/format'
30
30
  import { triggerDownload } from '@skyhook-io/k8s-ui/utils/download'
31
31
  import { ApiError, useCapabilities, useRadarFeature } from '../../api/client'
32
32
  import { useAPIResources } from '../../api/apiResources'
33
+ import { useRadarUpgradeHost } from '../../context/RadarUpgradeHost'
33
34
  import {
34
35
  fetchVulnerabilitiesCSV,
35
36
  hasVulnerabilityReports,
@@ -45,23 +46,27 @@ import {
45
46
  type VulnerabilityCVE,
46
47
  type VulnerabilityFix,
47
48
  type VulnerabilityGap,
49
+ type VulnerabilityRiskFactor,
50
+ type VulnerabilityIntel,
48
51
  type VulnerabilitySeverity,
49
52
  type VulnerabilityView,
50
53
  type VulnerabilityWorkload,
51
54
  type VulnerabilityWorkloadRef,
52
55
  type VulnerableImage,
56
+ ownerLookup,
53
57
  } from '../../api/vulnerabilities'
54
58
  import type { SelectedResource } from '../../types'
59
+ import { SeeTrafficLink } from '../vulnerabilities/traffic'
60
+ import { OwnerCell, OwnerProvider, ownerInfo, ownerTip, uncheckedReadsText, useOwners } from '../vulnerabilities/owner'
61
+ import { EndOfLifeNote, OptionalHead, OsLabel, availableColumns, columnsFor, daysSince, isoDate, optionalColumn, useOptionalColumns } from '../vulnerabilities/columns'
55
62
  import { useConnection } from '../../context/ConnectionContext'
56
63
  import { useDesktopDownload } from '../../hooks/useDesktopDownload'
57
64
  import { ChecksViewTabs } from './ChecksViewTabs'
58
65
  import { Java4ShellPanel } from './Java4ShellPanel'
59
66
  import {
60
- SEVERITIES,
61
- SeverityBadge,
67
+ SeverityText,
62
68
  SeverityBar,
63
69
  SeverityCounts,
64
- distinctNamespaces,
65
70
  totalFindings,
66
71
  FindingTotal,
67
72
  installedLabel,
@@ -75,19 +80,35 @@ import {
75
80
  OTHER_BUILD_TIP,
76
81
  imageParts,
77
82
  gapSentence,
78
- WorkloadSummary,
79
83
  ExposedMark,
80
84
  exposureLookup,
81
85
  routesFor,
82
86
  routeText,
83
87
  routesTip,
84
- ExposedCount,
85
88
  exposureUnknownIn,
86
89
  exposureGapSentence,
87
90
  uncheckedRoutesSentence,
88
91
  EXPOSURE,
92
+ KEV,
93
+ InRowSummary,
94
+ KevBadge,
95
+ KevCount,
96
+ EpssValue,
97
+ feedReady,
98
+ feedNote,
99
+ feedStatusText,
100
+ intelNotes,
89
101
  type ExposureLookup,
102
+ RiskContext,
103
+ RISK_ORDER,
104
+ SERIOUS_RISKS,
105
+ RowRiskBadge,
106
+ WorkloadRiskBadge,
107
+ useTipTarget,
108
+ WorkloadsCell,
109
+ riskLookup,
90
110
  } from '../vulnerabilities/parts'
111
+ import { MoreFilters, SEVERITY_FILTERS, SeverityFilter } from '../vulnerabilities/filters'
91
112
 
92
113
  interface VulnerabilitiesViewProps {
93
114
  namespaces: string[]
@@ -108,12 +129,18 @@ const TRIVY_INSTALL_URL = 'https://aquasecurity.github.io/trivy-operator/latest/
108
129
  // Each table's columns, shared by its header, rows and expanded sub-rows so
109
130
  // detail lines up under the column it belongs to. Short values get fixed
110
131
  // tracks; the text columns take the rest.
111
- const IMAGE_COLS = 'grid-cols-[minmax(220px,1.6fr)_minmax(180px,1.2fr)_88px_minmax(0,2fr)_72px]'
112
- const FIX_COLS = 'grid-cols-[minmax(200px,1.2fr)_minmax(220px,1.5fr)_120px_minmax(0,1.6fr)_64px_80px]'
113
- const CVE_COLS = 'grid-cols-[minmax(260px,1.6fr)_80px_48px_minmax(200px,1.6fr)_56px_64px_80px]'
114
- const WORKLOAD_COLS = 'grid-cols-[minmax(200px,1.4fr)_minmax(180px,1.2fr)_minmax(0,2.4fr)]'
115
- // With the route column, shown only when the answer reports exposure.
116
- const WORKLOAD_ROUTE_COLS = 'grid-cols-[minmax(200px,1.4fr)_minmax(180px,1.2fr)_minmax(180px,1.2fr)_minmax(0,2fr)]'
132
+ // The image and CVE tables have optional columns (vulnerabilities/columns),
133
+ // so their tracks are built per render rather than fixed classes. EPSS
134
+ // also needs an answer that carries the feeds, whatever the setting.
135
+ const gridOf = (tracks: (string | false | undefined)[]): React.CSSProperties => ({ gridTemplateColumns: tracks.filter(Boolean).join(' ') })
136
+ const trackOf = (view: VulnerabilityView, name: string, on: boolean | undefined) => on && optionalColumn(view, name)?.track
137
+ // Workloads is one line, "6 · 4 exposed" and the risk badge, so it gets a
138
+ // text track rather than a narrow number column.
139
+ const imageGrid = (c: Record<string, boolean>) => gridOf(['minmax(220px,1.6fr)', trackOf('image', 'os', c.os), 'minmax(180px,1.2fr)', '88px', 'minmax(0,1.6fr)', trackOf('image', 'scanner', c.scanner), '72px'])
140
+ const cveGrid = (c: Record<string, boolean>) => gridOf(['minmax(260px,1.6fr)', '72px', '48px', trackOf('cve', 'epss', c.epss), trackOf('cve', 'published', c.published), trackOf('cve', 'age', c.age), 'minmax(180px,1.4fr)', '56px', '64px', 'minmax(200px,1.2fr)'])
141
+ const FIX_COLS = 'grid-cols-[minmax(200px,1.2fr)_minmax(220px,1.5fr)_minmax(120px,0.8fr)_64px_minmax(220px,1.4fr)]'
142
+ // The route column shows only when the answer reports exposure.
143
+ const workloadGrid = (route: boolean, c: Record<string, boolean>) => gridOf(['minmax(200px,1.4fr)', trackOf('workload', 'owner', c.owner), 'minmax(180px,1.2fr)', route && 'minmax(180px,1.2fr)', route ? 'minmax(0,2fr)' : 'minmax(0,2.4fr)'])
117
144
  const HEAD = 'grid gap-4 border-b border-theme-border py-2 pl-10 pr-3 text-[11px] font-semibold uppercase tracking-wider text-theme-text-tertiary'
118
145
  const FOLD_ROW = 'grid grid-cols-[minmax(220px,1.6fr)_minmax(0,4fr)] items-baseline gap-4 py-1.5 pl-10 pr-3 text-xs'
119
146
  const SUB = 'grid items-baseline gap-4 py-1.5 pl-10 pr-3 text-xs'
@@ -127,9 +154,12 @@ const toResource = (w: VulnerabilityWorkloadRef): SelectedResource => ({ kind: w
127
154
  export function VulnerabilitiesView({ namespaces, onNavigateToResource }: VulnerabilitiesViewProps) {
128
155
  const [params, setParams] = useSearchParams()
129
156
  const view = (VIEWS.find((v) => v.key === params.get('by'))?.key ?? 'fix') as VulnerabilityView
130
- const severities = (params.get('severity') ?? '').split(',').filter((s): s is VulnerabilitySeverity => LEGEND.some((x) => x.key === s))
157
+ const severities = (params.get('severity') ?? '').split(',').filter((s): s is VulnerabilitySeverity => SEVERITY_FILTERS.some((x) => x.key === s))
131
158
  const fixableOnly = params.get('fixable') === '1'
132
159
  const exposedOnly = params.get('exposed') === '1'
160
+ const eolOnly = params.get('eol') === '1'
161
+ const risks = (params.get('risk') ?? '').split(',').filter((r): r is VulnerabilityRiskFactor => RISK_ORDER.includes(r as VulnerabilityRiskFactor))
162
+ const optional = useOptionalColumns()
133
163
  const queryDraft = params.get('q') ?? ''
134
164
  const workload = parseWorkloadParam(params.get('workload'))
135
165
  const query = useDebouncedValue(queryDraft.trim(), 300)
@@ -137,6 +167,23 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
137
167
  const { data: capabilities } = useCapabilities()
138
168
  const { data: resources } = useAPIResources()
139
169
  const java4ShellSupported = capabilities?.features?.runtimeAdvisoryChecks === true
170
+ // kev=1 goes only to a Radar that filters by it: an older one would answer
171
+ // every row under a shared link's Known exploited filter.
172
+ const { support: intelSupport, upgrade: intelUpgrade } = useRadarFeature('vulnerabilityIntel')
173
+ const kevRequested = params.get('kev') === '1'
174
+ // When Radar refused kev=1 for want of the catalog: the page then reads
175
+ // without it, keeps it in the URL and says it isn't applied. retriedAt is
176
+ // the ready answer that applied it again, so the cached refusal from
177
+ // before it doesn't count twice.
178
+ const [kevRefusal, setKevRefusal] = useState<{ at: number | null; retriedAt: number }>({ at: null, retriedAt: -Infinity })
179
+ const kevRefusedAt = kevRefusal.at
180
+ const kevOnly = kevRequested && intelSupport === 'supported' && kevRefusedAt === null
181
+ // In Radar Cloud (the host that owns upgrades, or a Radar in Cloud mode),
182
+ // a cluster whose Radar predates KEV gets a quiet line where the Known
183
+ // exploited chip would be.
184
+ const { onRequestRadarUpgrade } = useRadarUpgradeHost()
185
+ const inRadarCloud = !!onRequestRadarUpgrade || capabilities?.deployment?.mode === 'cloud'
186
+ const intelUpgradeNote = inRadarCloud && capabilities?.features?.vulnerabilities === true ? intelUpgrade : null
140
187
  const reportsAbsent = java4ShellSupported && resources !== undefined && !hasVulnerabilityReports(resources)
141
188
 
142
189
  // Typing and chip toggles replace the entry; a new view or a drill-down
@@ -146,9 +193,23 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
146
193
  mutate(next)
147
194
  setParams(next, { replace: !push })
148
195
  }
149
- const tableParams: VulnerabilitiesParams = { view, namespaces, severities, fixableOnly, exposed: exposedOnly, query, workload }
150
- const { data, isLoading, isFetching, isPlaceholderData, error, dataUpdatedAt, refetch } = useVulnerabilities(tableParams, !reportsAbsent)
196
+ const tableParams: VulnerabilitiesParams = { view, namespaces, severities, fixableOnly, exposed: exposedOnly, osEndOfLife: eolOnly, risk: risks, kev: kevOnly, query, workload }
197
+ const { data, isLoading, isFetching, isPlaceholderData, error, dataUpdatedAt, errorUpdatedAt, refetch } = useVulnerabilities(tableParams, !reportsAbsent)
151
198
  const hasReports = !reportsAbsent && (hasVulnerabilityReports(resources) || !!data)
199
+ // A shared link's Known exploited filter on a Radar without the catalog
200
+ // (no Radar Cloud, or Radar Cloud's copy isn't available) is refused with
201
+ // 503 kev_unavailable: the page then shows every row and says the filter
202
+ // isn't applied, and refuses the CSV, which would list every row too.
203
+ // While the catalog is on its way the answer is kev_loading, which is
204
+ // retried (readSettles) with the filter kept. An answer read after the
205
+ // refusal whose catalog is ready applies the filter again; answers from
206
+ // before don't, or the two would take turns. Set during render, as
207
+ // React's derived state is, so the refused request isn't sent twice.
208
+ const kevRefusedNow = error instanceof ApiError && error.data?.error_code === 'kev_unavailable'
209
+ const refusalAt = errorUpdatedAt ?? 0
210
+ if (kevRefusedNow && kevRefusedAt === null && refusalAt > kevRefusal.retriedAt) setKevRefusal({ at: refusalAt, retriedAt: kevRefusal.retriedAt })
211
+ if (kevRefusedAt !== null && feedReady(data?.intel?.kev) && dataUpdatedAt > kevRefusedAt) setKevRefusal({ at: null, retriedAt: dataUpdatedAt })
212
+ const kevNotApplied = kevRequested && (intelSupport === 'unsupported' || kevRefusedAt !== null)
152
213
  const trivySearch = new URLSearchParams({ by: 'cve', q: JAVA4SHELL_CVE })
153
214
  for (const key of ['namespace', 'namespaces']) {
154
215
  const value = params.get(key)
@@ -164,35 +225,29 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
164
225
  />
165
226
  )
166
227
 
167
- const toggleSeverity = (s: VulnerabilitySeverity) => update((p) => {
168
- const next = severities.includes(s) ? severities.filter((x) => x !== s) : [...severities, s]
169
- if (next.length > 0) p.set('severity', next.join(','))
170
- else p.delete('severity')
171
- })
228
+ const setSeverities = (next: VulnerabilitySeverity[]) => update((p) => (next.length > 0 ? p.set('severity', next.join(',')) : p.delete('severity')))
172
229
 
230
+ const header = <PageHeader icon={ShieldAlert} title="Vulnerabilities" />
173
231
  if (isLoading && !reportsAbsent) {
174
232
  return (
175
233
  <div className="flex-1 flex flex-col min-h-0 p-4 gap-4 overflow-auto">
176
234
  <ChecksViewTabs />
177
- {advisory && <PageHeader icon={ShieldAlert} title="Vulnerabilities" />}
235
+ {header}
178
236
  {advisory}
179
237
  <PaneLoader label="Reading vulnerability reports…" className="flex-1" />
180
238
  </div>
181
239
  )
182
240
  }
183
241
  if (!data || reportsAbsent) {
184
- const showInstallNote = advisory && (reportsAbsent || isKindUnknown(error))
242
+ // No report kind: nothing failed, the cluster has no scanner yet.
243
+ const noScanner = reportsAbsent || isKindUnknown(error)
185
244
  return (
186
245
  <div className="flex-1 flex flex-col min-h-0 p-4 gap-4 overflow-auto">
187
246
  <ChecksViewTabs />
188
- {advisory && <PageHeader icon={ShieldAlert} title="Vulnerabilities" />}
247
+ {/* Only here does the line under the title say what the page is for. */}
248
+ {noScanner ? <PageHeader icon={ShieldAlert} title="Vulnerabilities" description={PAGE_DESCRIPTION} /> : header}
189
249
  {advisory}
190
- {showInstallNote ? (
191
- <p className="text-xs text-theme-text-secondary">
192
- General image vulnerability scanning requires Trivy Operator.{' '}
193
- <a href={TRIVY_INSTALL_URL} target="_blank" rel="noreferrer" className="text-accent-text hover:underline">Installation guide</a>
194
- </p>
195
- ) : (
250
+ {noScanner ? <NoScannerState /> : (
196
251
  <div className="flex flex-1 items-center justify-center"><VulnerabilitiesError error={error} /></div>
197
252
  )}
198
253
  </div>
@@ -200,38 +255,75 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
200
255
  }
201
256
 
202
257
  // By fix lists only fixable findings, and hides the chip that says so.
203
- // An older Radar ignores exposed=1 and reports no exposure.
258
+ // An older Radar ignores exposed=1 and reports no exposure, and ignores
259
+ // eol=1 and sends no end-of-life count.
204
260
  const exposure = data.exposure
205
- const filtered = severities.length > 0 || (fixableOnly && view !== 'fix') || (exposedOnly && !!exposure) || query !== '' || !!workload
261
+ const eolCount = data.summary.imagesOsEndOfLife
262
+ // Offered when there is something to filter to, and always while a link sets it.
263
+ const eolFilter = eolCount !== undefined && (eolOnly || eolCount > 0)
264
+ // An older Radar ignores risk= and sends no podRisk.
265
+ const podRisk = data.podRisk
266
+ const riskCounts = podRisk?.counts
267
+ // Serious risk is on exactly when the URL selects the serious factors and
268
+ // nothing else.
269
+ const seriousOnly = new Set(risks).size === SERIOUS_RISKS.length && SERIOUS_RISKS.every((f) => risks.includes(f))
270
+ // Filters are hidden, never empty-looking, when no workload in scope has
271
+ // what they filter to; a link that sets one still shows it.
272
+ const seriousChip = !!riskCounts && (seriousOnly || SERIOUS_RISKS.some((f) => (riskCounts[f] ?? 0) > 0))
273
+ const riskFilter = !!riskCounts && (risks.length > 0 || Object.values(riskCounts).some((n) => n > 0))
274
+ // An older Radar carries no intel and ignores kev=1.
275
+ const intel = data.intel
276
+ const kevReady = feedReady(intel?.kev)
277
+ // Before any image is scanned there is nothing to count, and "0" would
278
+ // read as none; a link that sets the filter still shows it.
279
+ const kevChip = !!intel && (data.summary.imagesScanned > 0 || kevRequested)
280
+ const kevNotAppliedWhy = kevNotApplied ? kevNotAppliedReason(intel) : undefined
281
+ const filtered = severities.length > 0 || (fixableOnly && view !== 'fix') || (exposedOnly && !!exposure) || (eolOnly && eolCount !== undefined) || (risks.length > 0 && !!podRisk) || (kevOnly && !!intel) || query !== '' || !!workload
206
282
  // Narrowed only to a workload whose images are all clean or unscanned:
207
283
  // the folds below list them, so "nothing matches" would mislead.
208
- const workloadFolds = !!workload && (view === 'image' || view === 'workload') && severities.length === 0 && !fixableOnly && query === '' &&
284
+ const workloadFolds = !!workload && (view === 'image' || view === 'workload') && severities.length === 0 && !fixableOnly && !(exposedOnly && !!exposure) && !(eolOnly && eolCount !== undefined) && query === '' &&
209
285
  ((data.unscanned ?? []).length > 0 || (data.clean ?? []).length > 0 || (data.cleanWorkloads ?? []).length > 0)
210
286
  const rows = view === 'cve' ? data.cves ?? [] : view === 'workload' ? data.workloads ?? [] : view === 'fix' ? data.fixes ?? [] : data.images ?? []
287
+ // The clean fold lists the scanned images (or workloads) the filters keep
288
+ // that have no reported CVEs: they match too. A filter on findings hides
289
+ // the fold, since a clean image has none to match.
290
+ const cleanShown = !severities.length && !fixableOnly && !(kevOnly && data.intel)
291
+ const cleanMatches = cleanShown ? cleanCount(data, view) : 0
211
292
 
212
293
  // With nothing scanned or readable there are no counts to show or filter.
213
294
  const known = findingsCertainty(data) !== 'unknown'
214
295
  // A new view or filter starts again from the first page of rows.
215
- const pageKey = JSON.stringify([view, namespaces, severities, fixableOnly, exposedOnly, query, workload])
216
- const fixChip = known && view !== 'fix'
296
+ // Every filter lives in the URL; the view and the namespace scope aren't filters.
297
+ const clearFilters = () => update((p) => { for (const key of FILTER_KEYS) p.delete(key) }, true)
298
+ const pageKey = JSON.stringify([view, namespaces, severities, fixableOnly, exposedOnly, eolOnly, risks, kevOnly, query, workload])
299
+ const ownerMenu = ownerMenuNote(data)
300
+ // A column of blanks would look broken, so with none found the menu item
301
+ // says so instead. A column of "Not checked" says something, so it stays.
302
+ const ownerNone = ownerMenu === NO_OWNER
303
+ const fixFilter = known && view !== 'fix'
217
304
  return (
218
305
  <div aria-busy={isFetching} className="flex-1 flex flex-col min-h-0 p-4 gap-4 overflow-auto">
219
306
  <ChecksViewTabs />
220
307
  <PageHeader
221
308
  icon={ShieldAlert}
222
309
  title="Vulnerabilities"
223
- description="Known CVEs in the images that run now, from Trivy Operator's reports."
224
310
  actions={
225
311
  <div className="flex items-center gap-2">
226
312
  <FreshnessControl mode="auto" dataUpdatedAt={dataUpdatedAt} isFetching={isFetching} onRefresh={() => refetch()} connectionState={connection.state} />
227
- <ExportMenu params={tableParams} cluster={connection.clusterName || connection.context} />
313
+ <PageMenu
314
+ params={tableParams}
315
+ downloadBlocked={kevRequested && !kevOnly ? KEV.downloadBlocked : undefined}
316
+ cluster={connection.clusterName || connection.context}
317
+ columns={data.view === view ? availableColumns(view, data).map((c) => ({ key: c.key, label: c.label, shown: optional.shown.has(c.key), ...(c.key === 'workload.owner' ? ownerMenu : {}) })) : []}
318
+ onToggleColumn={optional.toggle}
319
+ />
228
320
  </div>
229
321
  }
230
322
  />
231
323
  {advisory}
232
324
 
233
325
  {/* Triage header, as on Best practices: the headline, the severity
234
- distribution, and its legend as the severity filters. */}
326
+ distribution, and one line of filters with the view switcher. */}
235
327
  <div className={clsx('flex flex-col gap-3.5 rounded-2xl border border-theme-border bg-theme-surface p-4 shadow-theme-sm transition-opacity', isPlaceholderData && 'opacity-60')}>
236
328
  <div className="flex flex-wrap items-end justify-between gap-3">
237
329
  <SummaryHeadline data={data} />
@@ -249,24 +341,21 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
249
341
  </div>
250
342
 
251
343
  {known && <DistributionBar
252
- ariaLabel="Findings by severity"
253
- segments={LEGEND.map((s) => ({ key: s.key, count: data.summary.counts[s.key], fillClass: VULN_SEVERITY_BAR[s.key.toUpperCase()] }))}
344
+ ariaLabel={`Findings by severity: ${SEVERITY_FILTERS.map((s) => `${data.summary.counts[s.key]} ${s.label}`).join(', ')}`}
345
+ segments={SEVERITY_FILTERS.map((s) => ({ key: s.key, count: data.summary.counts[s.key], fillClass: VULN_SEVERITY_BAR[s.key.toUpperCase()] }))}
254
346
  />}
255
347
 
256
348
  <div className="flex flex-wrap items-center gap-1.5">
257
- {known && LEGEND.map((s) => (
258
- <DistributionLegendChip
259
- key={s.key}
260
- label={s.label}
261
- count={data.summary.counts[s.key]}
262
- fillClass={VULN_SEVERITY_BAR[s.key.toUpperCase()]}
263
- textClass={VULN_SEVERITY_TEXT[s.key.toUpperCase()]}
264
- active={severities.includes(s.key)}
265
- onClick={() => toggleSeverity(s.key)}
349
+ {known && <SeverityFilter counts={data.summary.counts} selected={severities} onChange={setSeverities} />}
350
+ {known && (exposure || seriousChip || kevChip || fixFilter || eolFilter || riskFilter) && <span aria-hidden className="mx-1.5 h-5 w-px bg-theme-border" />}
351
+ {kevChip && intel && (
352
+ <KnownExploitedChip
353
+ intel={intel}
354
+ active={kevOnly}
355
+ count={kevReady && data.summary.imagesScanned > 0 ? data.summary.kevCves : undefined}
356
+ onClick={() => update((p) => (kevOnly ? p.delete('kev') : p.set('kev', '1')))}
266
357
  />
267
- ))}
268
- {(fixChip || exposure) && <span aria-hidden className="mx-1.5 h-5 w-px bg-theme-border" />}
269
- {fixChip && <FilterPill label="Fix available" tooltip="Only findings the scanner lists a fixed release for" active={fixableOnly} onClick={() => update((p) => (fixableOnly ? p.delete('fixable') : p.set('fixable', '1')))} />}
358
+ )}
270
359
  {exposure && (
271
360
  <FilterPill
272
361
  label={EXPOSURE.chip}
@@ -276,6 +365,25 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
276
365
  onClick={() => update((p) => (exposedOnly ? p.delete('exposed') : p.set('exposed', '1')))}
277
366
  />
278
367
  )}
368
+ {seriousChip && (
369
+ <FilterPill
370
+ label="Serious risk"
371
+ tooltip="Only rows affecting a workload that is privileged, has host access or runs as root. Leaves out may run as root and privilege escalation, which mark most workloads."
372
+ active={seriousOnly}
373
+ onClick={() => update((p) => (seriousOnly ? p.delete('risk') : p.set('risk', SERIOUS_RISKS.join(','))))}
374
+ />
375
+ )}
376
+ <MoreFilters
377
+ fixable={fixFilter ? { on: fixableOnly, onToggle: () => update((p) => (fixableOnly ? p.delete('fixable') : p.set('fixable', '1'))) } : undefined}
378
+ endOfLife={eolFilter ? { on: eolOnly, count: eolCount ?? 0, onToggle: () => update((p) => (eolOnly ? p.delete('eol') : p.set('eol', '1'))) } : undefined}
379
+ risk={riskFilter && riskCounts ? {
380
+ counts: riskCounts,
381
+ selected: risks,
382
+ seriousOnly,
383
+ onChange: (next) => update((p) => (next.length > 0 ? p.set('risk', next.join(',')) : p.delete('risk'))),
384
+ } : undefined}
385
+ onClearAll={() => update((p) => { for (const key of ['fixable', 'eol', 'risk']) p.delete(key) })}
386
+ />
279
387
  {workload && (
280
388
  <>
281
389
  <span aria-hidden className="mx-1.5 h-5 w-px bg-theme-border" />
@@ -288,25 +396,40 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
288
396
  </span>
289
397
  </>
290
398
  )}
291
- <div role="group" aria-label="Group by" className="ml-auto flex rounded-md border border-theme-border bg-theme-elevated p-0.5">
399
+ <div role="group" aria-label="Group by" className="ml-auto flex shrink-0 rounded-md border border-theme-border bg-theme-elevated p-0.5">
292
400
  {VIEWS.map((v) => (
293
401
  <button
294
402
  key={v.key}
295
403
  type="button"
296
404
  aria-pressed={view === v.key}
297
405
  onClick={() => update((p) => (v.key === 'fix' ? p.delete('by') : p.set('by', v.key)), true)}
298
- className={clsx('min-h-7 rounded px-3 text-xs font-medium transition-colors', view === v.key ? 'bg-theme-hover text-theme-text-primary' : 'text-theme-text-secondary hover:text-theme-text-primary')}
406
+ className={clsx('min-h-7 whitespace-nowrap rounded px-3 text-xs font-medium transition-colors', view === v.key ? 'bg-theme-hover text-theme-text-primary' : 'text-theme-text-secondary hover:text-theme-text-primary')}
299
407
  >
300
408
  {v.label}
301
409
  </button>
302
410
  ))}
303
411
  </div>
304
412
  </div>
413
+ {!intel && intelUpgradeNote && <RadarUpgradeNote requirement={intelUpgradeNote} />}
305
414
  </div>
306
415
 
307
416
  <div className="flex flex-col gap-1.5">
308
- <CoverageNotes data={data} filtered={filtered} view={view} />
309
- {error && <p className="text-xs text-warning-text">Couldn't refresh: {error instanceof Error ? error.message : 'request failed'}. Showing the last answer.</p>}
417
+ <CoverageNotes
418
+ data={data}
419
+ view={view}
420
+ matches={filtered && known && data.view === view ? {
421
+ count: rows.length + (data.coverage.rowsOmitted ?? 0) + cleanMatches,
422
+ // Every filter lives in the URL; the view and the namespace scope aren't filters.
423
+ onClear: clearFilters,
424
+ } : undefined}
425
+ />
426
+ {kevNotAppliedWhy && (
427
+ <p className="text-xs text-warning-text">
428
+ {KEV.notApplied} {kevNotAppliedWhy}{' '}
429
+ <button type="button" onClick={() => { setKevRefusal((r) => ({ ...r, at: null })); update((p) => p.delete('kev')) }} className="text-accent-text hover:underline">Remove the filter</button>
430
+ </p>
431
+ )}
432
+ {error && !kevRefusedNow && <p className="text-xs text-warning-text">Couldn't refresh: {error instanceof Error ? error.message : 'request failed'}. Showing the last answer.</p>}
310
433
  </div>
311
434
 
312
435
  {/* A view switched to for the first time shows the last answer's
@@ -314,21 +437,24 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
314
437
  {data.view !== view ? (
315
438
  <PaneLoader label="Reading vulnerability reports…" className="min-h-48" />
316
439
  ) : (
317
- <>
440
+ <RiskContext.Provider value={{ lookup: riskLookup(podRisk), selected: new Set(risks), onOpen: (w) => onNavigateToResource(toResource(w)) }}>
441
+ <OwnerProvider info={ownerInfo(data)}>
318
442
  {rows.length === 0 ? (
319
443
  <EmptyState
320
444
  tone="neutral"
321
445
  icon={ShieldAlert}
322
- headline={emptyHeadline(view, filtered, data, workloadFolds ? workload : null)}
323
- body={filtered && !workloadFolds ? 'Clear a filter to see more.' : data.summary.imagesScanned === 0 && (data.unscanned ?? []).length > 0 ? 'No report covers a running image yet. Trivy Operator scans workloads as they appear; if this persists, check that it is running and that its target namespaces include these.' : undefined}
446
+ headline={emptyHeadline(view, filtered, data, workloadFolds ? workload : null, cleanMatches)}
447
+ action={filtered && !workloadFolds ? <button type="button" onClick={clearFilters} className="btn-secondary px-3 py-1.5 text-xs font-medium">Clear filters</button> : undefined}
448
+ body={filtered && !workloadFolds ? undefined : data.summary.imagesScanned === 0 && data.summary.imagesUnscanned > 0 ? 'Trivy Operator scans each workload shortly after it starts. If nothing appears within a few minutes, check that it is running and that its target namespaces include these. The images waiting for a report are listed below.' : undefined}
324
449
  />
325
450
  ) : view === 'fix' ? (
326
451
  <Paged key={pageKey} rows={data.fixes ?? []}>{(rows) => <FixTable fixes={rows} onOpen={(w) => onNavigateToResource(toResource(w))} onShowCVE={(id) => update((p) => { p.set('by', 'cve'); p.set('q', id) }, true)} />}</Paged>
327
452
  ) : view === 'cve' ? (
328
- <Paged key={pageKey} rows={data.cves ?? []}>{(rows) => <CVETable cves={rows} onOpen={(w) => onNavigateToResource(toResource(w))} />}</Paged>
453
+ <Paged key={pageKey} rows={data.cves ?? []}>{(rows) => <CVETable cves={rows} columns={columnsFor('cve', optional.shown, data)} intel={intel} onOpen={(w) => onNavigateToResource(toResource(w))} />}</Paged>
329
454
  ) : view === 'workload' ? (
330
455
  <Paged key={pageKey} rows={data.workloads ?? []}>{(rows) => <WorkloadTable
331
456
  workloads={rows}
457
+ columns={{ ...columnsFor('workload', optional.shown, data), ...(ownerNone && { owner: false }) }}
332
458
  exposure={exposure}
333
459
  severities={severities}
334
460
  query={query}
@@ -339,6 +465,7 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
339
465
  ) : (
340
466
  <Paged key={pageKey} rows={data.images ?? []}>{(rows) => <ImageTable
341
467
  images={rows}
468
+ columns={columnsFor('image', optional.shown, data)}
342
469
  onOpen={(w) => onNavigateToResource(toResource(w))}
343
470
  onOpenReport={(img) => onNavigateToResource({ kind: img.report.kind, group: img.report.group, namespace: img.report.namespace ?? '', name: img.report.name })}
344
471
  />}</Paged>
@@ -348,11 +475,12 @@ export function VulnerabilitiesView({ namespaces, onNavigateToResource }: Vulner
348
475
  <p className="text-xs text-theme-text-tertiary">{data.coverage.rowsOmitted} more rows not shown. Narrow with a filter or the namespace picker.</p>
349
476
  )}
350
477
 
351
- {!severities.length && !fixableOnly && (view === 'image' || view === 'workload') && (
478
+ {cleanShown && (view === 'image' || view === 'workload') && (
352
479
  <CleanList data={data} view={view} onOpen={(w) => onNavigateToResource(toResource(w))} />
353
480
  )}
354
481
  <UnscannedList data={data} onOpen={(w) => onNavigateToResource(toResource(w))} />
355
- </>
482
+ </OwnerProvider>
483
+ </RiskContext.Provider>
356
484
  )}
357
485
  </div>
358
486
  )
@@ -363,8 +491,17 @@ const VIEW_NAMES: Partial<Record<VulnerabilityView, string>> = { fix: 'By fix',
363
491
  // The page's overflow menu: CSV of the view on screen with its filters, or
364
492
  // of every finding (one row per CVE, image and workload, the shape a POA&M
365
493
  // or a ticket import wants). Each lists every row and every value the table
366
- // shortens.
367
- function ExportMenu({ params, cluster }: { params: VulnerabilitiesParams; cluster: string }) {
494
+ // shortens. Below them, after a divider, a checkbox for each of the view's
495
+ // optional columns.
496
+ function PageMenu({ params, downloadBlocked, cluster, columns: columnChoices, onToggleColumn }: {
497
+ params: VulnerabilitiesParams
498
+ /** Why the downloads are off: the file would be wider than the link asks for. */
499
+ downloadBlocked?: string
500
+ cluster: string
501
+ /** The view's optional columns this answer has data for. */
502
+ columns: { key: string; label: string; shown: boolean; hint?: string; tooltip?: string }[]
503
+ onToggleColumn: (key: string) => void
504
+ }) {
368
505
  const { support, guard } = useRadarFeature('vulnerabilitiesExport')
369
506
  const desktopDownload = useDesktopDownload()
370
507
  const download = useMutation({
@@ -373,52 +510,105 @@ function ExportMenu({ params, cluster }: { params: VulnerabilitiesParams; cluste
373
510
  onSuccess: (csv, { as, cluster }) => triggerDownload(csv, 'text/csv;charset=utf-8', vulnerabilitiesCSVFilename(as, cluster), desktopDownload),
374
511
  meta: { errorMessage: 'Could not download the CSV' },
375
512
  })
376
- if (support !== 'supported') return null
377
513
  const pending = download.isPending ? download.variables?.as : undefined
378
- return (
379
- <RowActionMenu
380
- compact={false}
381
- ariaLabel="More actions"
382
- items={[
383
- { key: 'view', label: `Download ${VIEW_NAMES[params.view] ?? 'this view'} as CSV`, icon: FileSpreadsheet, pending: pending === params.view, disabled: !!pending, onClick: () => download.mutate({ params, as: params.view, cluster }) },
384
- { key: 'findings', label: 'Download all findings as CSV', icon: FileSpreadsheet, pending: pending === 'findings', disabled: !!pending, onClick: () => download.mutate({ params, as: 'findings', cluster }) },
385
- ]}
386
- />
387
- )
514
+ const downloads: RowActionItem[] = support !== 'supported' ? [] : [
515
+ { key: 'view', label: `Download ${VIEW_NAMES[params.view] ?? 'this view'} as CSV`, icon: FileSpreadsheet, pending: pending === params.view, disabled: !!pending || !!downloadBlocked, disabledReason: downloadBlocked, onClick: () => download.mutate({ params, as: params.view, cluster }) },
516
+ { key: 'findings', label: 'Download all findings as CSV', icon: FileSpreadsheet, pending: pending === 'findings', disabled: !!pending || !!downloadBlocked, disabledReason: downloadBlocked, onClick: () => download.mutate({ params, as: 'findings', cluster }) },
517
+ ]
518
+ const columns: RowActionItem[] = columnChoices.map((c) => ({
519
+ key: c.key, label: `Show ${c.label}`, hint: c.hint, tooltip: c.tooltip, checked: c.shown, onClick: () => onToggleColumn(c.key),
520
+ }))
521
+ // Each group after the first opens with a divider.
522
+ const items = [downloads, columns].filter((g) => g.length > 0)
523
+ .flatMap((g, i) => g.map((item, j) => ({ ...item, divider: i > 0 && j === 0 })))
524
+ return <RowActionMenu compact={false} ariaLabel="More actions" items={items} />
388
525
  }
389
526
 
390
- function emptyHeadline(view: VulnerabilityView, filtered: boolean, data: VulnerabilitiesResponse, workload: { name: string } | null): string {
527
+ function emptyHeadline(view: VulnerabilityView, filtered: boolean, data: VulnerabilitiesResponse, workload: { name: string } | null, cleanMatches: number): string {
391
528
  // Narrowed to one workload, the folds below say what it runs.
392
529
  if (workload && (data.unscanned ?? []).length > 0) {
393
530
  const scanned = (data.clean ?? []).length > 0 || (data.cleanWorkloads ?? []).length > 0
394
531
  return scanned ? `No reported CVEs for ${workload.name}, and not every image it runs is scanned yet` : `No report yet for the images ${workload.name} runs`
395
532
  }
396
533
  if (workload && ((data.clean ?? []).length > 0 || (data.cleanWorkloads ?? []).length > 0)) return `No CVEs reported for ${workload.name}`
534
+ if (filtered && cleanMatches > 0) {
535
+ return view === 'image'
536
+ ? `None of the ${cleanMatches} matching ${cleanMatches === 1 ? 'image has' : 'images have'} a reported CVE`
537
+ : `None of the ${cleanMatches} matching ${cleanMatches === 1 ? 'workload runs' : 'workloads run'} an image with a reported CVE`
538
+ }
397
539
  if (filtered) return 'Nothing matches these filters'
398
540
  const s = data.summary
399
541
  if (!readsComplete(data.coverage) && totalFindings(s.counts) === 0 && s.imagesClean === 0) return 'No findings could be read in this scope'
400
- if (s.imagesScanned === 0) return 'No scanned images run in this scope'
542
+ if (s.imagesScanned === 0) return s.imagesUnscanned > 0 ? "Trivy hasn't scanned the images in this scope yet" : 'No workloads run in this scope'
401
543
  if (view === 'fix' && totalFindings(s.counts) > 0) return `None of the ${totalFindings(s.counts)} reported findings has a fixed release yet`
402
544
  return `No CVEs reported for the ${s.imagesScanned} scanned ${s.imagesScanned === 1 ? 'image' : 'images'} that run`
403
545
  }
404
546
 
547
+ const OWNER_LOOKS_FOR = 'It looks for a Helm release, an Argo CD or Flux app, or a team label on the workload or its namespace.'
548
+
549
+ const NO_OWNER = {
550
+ hint: 'none found',
551
+ tooltip: `Radar found no owner for these workloads. ${OWNER_LOOKS_FOR}`,
552
+ }
553
+
554
+ /**
555
+ * The Owner menu item's note when none of the table's workloads has an
556
+ * owner: "none found" only when Radar could look everywhere with the
557
+ * viewer's access. Owners of workloads only in the folds don't count; they
558
+ * show on hover there.
559
+ */
560
+ function ownerMenuNote(data: VulnerabilitiesResponse): { hint: string; tooltip: string } | undefined {
561
+ const ownership = data.ownership
562
+ if (!ownership || ownership.unavailable) return undefined
563
+ const find = ownerLookup(data.owners)
564
+ const owners = (data.workloads ?? []).map((w) => find(w))
565
+ if (owners.some((o) => o?.manager || o?.team)) return undefined
566
+ if (owners.some((o) => o?.managerUnchecked) || ownership.unchecked?.length) {
567
+ return {
568
+ hint: 'not checked with your access',
569
+ tooltip: `Radar couldn't check every place that names an owner for these workloads. ${uncheckedReadsText(ownership.unchecked) ?? "With your access, Radar couldn't read some of these workloads or the apps their labels name."} ${OWNER_LOOKS_FOR}`,
570
+ }
571
+ }
572
+ return owners.some((o) => o?.managerUnknown) ? undefined : NO_OWNER
573
+ }
574
+
575
+ const PAGE_DESCRIPTION = "Known CVEs in the images that run now, from Trivy Operator's reports."
576
+
577
+ // A cluster without Trivy Operator: what the page is for, and the one step
578
+ // that fills it. The Java4Shell check above it works without Trivy.
579
+ function NoScannerState() {
580
+ return (
581
+ <section aria-label="Trivy Operator not installed" className="flex flex-col gap-4 rounded-2xl border border-theme-border bg-theme-surface p-6 shadow-theme-sm">
582
+ <div className="flex items-start gap-3">
583
+ <ShieldAlert className="mt-0.5 h-5 w-5 shrink-0 text-theme-text-tertiary" aria-hidden />
584
+ <div className="flex flex-col gap-1">
585
+ <h2 className="text-base font-semibold text-theme-text-primary">Trivy Operator isn't installed in this cluster</h2>
586
+ <p className="max-w-2xl text-sm text-theme-text-secondary">
587
+ Radar reads the vulnerability reports Trivy Operator writes for each running image. With it installed, this page shows:
588
+ </p>
589
+ </div>
590
+ </div>
591
+ <ul className="grid max-w-3xl list-disc gap-x-8 gap-y-1.5 pl-12 text-sm text-theme-text-secondary sm:grid-cols-2">
592
+ <li>The package upgrades that clear the most Critical and High CVEs</li>
593
+ <li>Every image, CVE and workload, worst first</li>
594
+ <li>Which affected workloads have a route from outside the cluster</li>
595
+ <li>CSV downloads for a compliance tracker or a ticket import</li>
596
+ </ul>
597
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2 pl-8">
598
+ <a href={TRIVY_INSTALL_URL} target="_blank" rel="noreferrer" className="btn-brand inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium">
599
+ Install Trivy Operator <ExternalLink className="h-3.5 w-3.5" aria-hidden />
600
+ </a>
601
+ <span className="text-xs text-theme-text-tertiary">Findings appear here once Trivy has scanned your workloads.</span>
602
+ </div>
603
+ </section>
604
+ )
605
+ }
606
+
405
607
  function VulnerabilitiesError({ error }: { error: unknown }) {
406
608
  const upgrade = getRadarUpgradeRequirement(error)
407
609
  if (upgrade) {
408
610
  return <EmptyState tone="neutral" icon={ShieldAlert} headline={radarUpgradeHeadline('Vulnerability views')} body={radarUpgradeDetail(upgrade)} action={<RadarUpgradeAction requirement={upgrade} />} />
409
611
  }
410
- // A cluster without the report kind: nothing failed, there is no scanner.
411
- if (isKindUnknown(error)) {
412
- return (
413
- <EmptyState
414
- tone="neutral"
415
- icon={ShieldAlert}
416
- headline="No vulnerability reports in this cluster"
417
- body="General image vulnerability scanning requires Trivy Operator. When installed, its reports appear here."
418
- action={<a href={TRIVY_INSTALL_URL} target="_blank" rel="noreferrer" className="btn-brand px-3 py-1.5 text-xs font-medium">How to install Trivy Operator</a>}
419
- />
420
- )
421
- }
422
612
  return (
423
613
  <EmptyState
424
614
  tone="neutral"
@@ -429,9 +619,6 @@ function VulnerabilitiesError({ error }: { error: unknown }) {
429
619
  )
430
620
  }
431
621
 
432
- // Severities in the legend, unrated last: each is also a filter.
433
- const LEGEND: { key: VulnerabilitySeverity; label: string }[] = [...SEVERITIES.map(({ key, label }) => ({ key, label })), { key: 'unknown', label: 'Unrated' }]
434
-
435
622
  // The headline: images with Critical CVEs, then the other totals in a line.
436
623
  // Every total is a lower bound while anything is unscanned or unread.
437
624
  function SummaryHeadline({ data }: { data: VulnerabilitiesResponse }) {
@@ -462,12 +649,27 @@ function SummaryHeadline({ data }: { data: VulnerabilitiesResponse }) {
462
649
  }
463
650
 
464
651
  // How each view orders its rows, for the sort hint's tooltip.
465
- function sortRule(view: VulnerabilityView): string {
652
+ function sortRule(view: VulnerabilityView, kev: boolean): string {
466
653
  const tiebreak = view === 'workload' ? '' : ' Then the most exposed workloads, then the most workloads.'
467
- return `Most severe first. Within each severity, exposed rows come first, then those whose exposure is unknown.${tiebreak}`
654
+ const first = kev ? `rows with a known exploited CVE (CISA KEV) come first, then exposed rows, then` : 'exposed rows come first, then'
655
+ return `Most severe first. Within each severity, ${first} those whose exposure is unknown.${tiebreak}`
656
+ }
657
+
658
+ // The page's own filter keys: Clear filters removes these and leaves the
659
+ // view, the namespace scope and app state such as an open drawer.
660
+ const FILTER_KEYS = ['severity', 'fixable', 'exposed', 'eol', 'risk', 'kev', 'q', 'workload']
661
+
662
+ const ROW_NOUNS: Partial<Record<VulnerabilityView, [string, string]>> = {
663
+ fix: ['fix', 'fixes'], image: ['image', 'images'], cve: ['CVE', 'CVEs'], workload: ['workload', 'workloads'],
468
664
  }
469
665
 
470
- function CoverageNotes({ data, filtered, view }: { data: VulnerabilitiesResponse; filtered: boolean; view: VulnerabilityView }) {
666
+ function CoverageNotes({ data, view, matches }: {
667
+ data: VulnerabilitiesResponse
668
+ view: VulnerabilityView
669
+ /** Set while filters narrow the table: how many rows match, and how to clear them. */
670
+ matches?: { count: number; onClear: () => void }
671
+ }) {
672
+ const [one, many] = ROW_NOUNS[view] ?? ['row', 'rows']
471
673
  const gaps = gapSentence(data.coverage.gaps)
472
674
  const exposureNotes = [exposureGapSentence(data.exposure?.gaps), uncheckedRoutesSentence(data.exposure?.unchecked)].filter(Boolean).join(' ')
473
675
  const unscannedExposed = (data.unscanned ?? []).reduce((n, u) => n + (u.exposedTotal ?? 0), 0)
@@ -479,20 +681,28 @@ function CoverageNotes({ data, filtered, view }: { data: VulnerabilitiesResponse
479
681
  return (
480
682
  <div className="flex flex-col gap-1.5 text-xs">
481
683
  <p className="flex flex-wrap items-center gap-x-1.5 gap-y-1 text-theme-text-tertiary">
482
- {[scan, filtered ? 'Totals ignore the filters' : null].filter(Boolean).join(' · ')}
483
- {/* For someone comparing these numbers with Trivy's own: why they can differ. */}
484
- <WithTooltip tip={[
684
+ {scan}
685
+ {matches && (
686
+ <>
687
+ <span aria-hidden>·</span>
688
+ <span className="text-theme-text-secondary">{matches.count.toLocaleString('en-US')} {matches.count === 1 ? `${one} matches` : `${many} match`}</span>
689
+ <button type="button" onClick={matches.onClear} className="text-accent-text hover:underline">Clear filters</button>
690
+ </>
691
+ )}
692
+ {/* For someone comparing these numbers with Trivy's own: why they can differ.
693
+ With nothing scanned there are no numbers or order to explain. */}
694
+ {data.summary.imagesScanned > 0 && <WithTooltip tip={[
485
695
  "Reports list what was known when each image was scanned, after Trivy's own filters.",
486
696
  'A CVE counts once per package version in an image, and findings Trivy left unrated are rated from their CVSS score, so totals can differ from the summaries in Trivy\'s reports.',
487
697
  data.coverage.inactiveReports > 0 ? `${data.coverage.inactiveReports} ${data.coverage.inactiveReports === 1 ? 'report is' : 'reports are'} about older revisions or builds that don't run now, and ${data.coverage.inactiveReports === 1 ? "isn't" : "aren't"} counted.` : '',
488
698
  ].filter(Boolean).join(' ')}>
489
699
  <Info className="h-3.5 w-3.5" aria-label="How these numbers relate to Trivy's" />
490
- </WithTooltip>
491
- {data.exposure && (
492
- <WithTooltip tip={sortRule(view)}>
493
- <span className="inline-flex items-center gap-1 rounded px-1 hover:text-theme-text-secondary" tabIndex={0} aria-label={`Sort: ${sortRule(view)}`}>
700
+ </WithTooltip>}
701
+ {data.exposure && data.summary.imagesScanned > 0 && (
702
+ <WithTooltip tip={sortRule(view, feedReady(data.intel?.kev))}>
703
+ <span className="inline-flex items-center gap-1 rounded px-1 hover:text-theme-text-secondary" tabIndex={0} aria-label={`Sort: ${sortRule(view, feedReady(data.intel?.kev))}`}>
494
704
  <ArrowDownWideNarrow className="h-3.5 w-3.5" aria-hidden />
495
- Severity, then exposure
705
+ {feedReady(data.intel?.kev) ? 'Severity, known exploited, exposure' : 'Severity, then exposure'}
496
706
  </span>
497
707
  </WithTooltip>
498
708
  )}
@@ -504,6 +714,14 @@ function CoverageNotes({ data, filtered, view }: { data: VulnerabilitiesResponse
504
714
  </span>
505
715
  </WithTooltip>
506
716
  )}
717
+ {intelNotes(data.intel).map((n) => (
718
+ <WithTooltip key={n.label} tip={n.tip}>
719
+ <span className={clsx('inline-flex items-center gap-1', n.warn ? 'text-warning-text' : 'text-theme-text-tertiary')} tabIndex={0} aria-label={n.tip}>
720
+ <KEV.icon className="h-3.5 w-3.5" aria-hidden />
721
+ {n.label}
722
+ </span>
723
+ </WithTooltip>
724
+ ))}
507
725
  {unscannedExposed > 0 && (
508
726
  <WithTooltip tip="Exposed workloads whose images Trivy hasn't scanned yet: their findings are unknown. They're listed under the table.">
509
727
  <span className="inline-flex items-center gap-1 text-warning-text" tabIndex={0}>
@@ -538,15 +756,54 @@ function Paged<T>({ rows, children }: { rows: T[]; children: (rows: T[]) => Reac
538
756
  )
539
757
  }
540
758
 
759
+ // What keeps its own action in a row's summary: a click there doesn't toggle the row.
760
+ const ROW_CONTROLS = 'a[href], button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="menuitem"], [contenteditable="true"]'
761
+
762
+ /**
763
+ * A table row that opens to show more. A click anywhere on its summary
764
+ * toggles it, except on a control there (the risk badge, a link), on
765
+ * content drawn outside it (the risk popover), or at the end of a drag
766
+ * that selected text. For the keyboard the toggle is the chevron, a real
767
+ * button named by the summary, the row's one Tab stop besides its controls:
768
+ * a button can't hold the controls, so it doesn't wrap the summary.
769
+ */
541
770
  function Disclosure({ summary, children, flush = false }: { summary: React.ReactNode; children: React.ReactNode | ((open: boolean) => React.ReactNode); flush?: boolean }) {
542
771
  const [open, setOpen] = useState(false)
543
772
  const { panelId, buttonProps } = useDisclosure(open)
773
+ const summaryId = useId()
774
+ const rowRef = useRef<HTMLDivElement | null>(null)
775
+ const onRowClick = (e: React.MouseEvent) => {
776
+ const row = rowRef.current
777
+ const target = e.target as Element
778
+ // React passes on clicks from a portal drawn from inside the row.
779
+ if (!row || !row.contains(target)) return
780
+ const control = target.closest(ROW_CONTROLS)
781
+ if (control && row.contains(control)) return
782
+ const selection = window.getSelection()
783
+ if (selection && !selection.isCollapsed && selection.toString() !== '' && (row.contains(selection.anchorNode) || row.contains(selection.focusNode))) return
784
+ setOpen((o) => !o)
785
+ }
544
786
  return (
545
787
  <div className="border-b border-theme-border last:border-0">
546
- <button {...buttonProps} type="button" onClick={() => setOpen(!open)} className="flex w-full items-center gap-3 px-3 py-2.5 text-left hover:bg-theme-hover">
547
- <CollapseChevron open={open} className="h-4 w-4 shrink-0 text-theme-text-tertiary" />
548
- {summary}
549
- </button>
788
+ <div
789
+ ref={rowRef}
790
+ data-row-summary
791
+ onClick={onRowClick}
792
+ className="flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-theme-hover has-[>button:focus-visible]:bg-theme-hover"
793
+ >
794
+ <button
795
+ {...buttonProps}
796
+ type="button"
797
+ aria-labelledby={summaryId}
798
+ onClick={() => setOpen((o) => !o)}
799
+ className="-m-1 shrink-0 rounded p-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-theme-text-primary/20"
800
+ >
801
+ <CollapseChevron open={open} className="h-4 w-4 text-theme-text-tertiary" />
802
+ </button>
803
+ <div id={summaryId} className="flex min-w-0 flex-1">
804
+ <InRowSummary>{summary}</InRowSummary>
805
+ </div>
806
+ </div>
550
807
  <Collapse open={open} id={panelId} mountLazily>
551
808
  <div className={clsx('border-t border-theme-border bg-theme-base', flush ? 'py-2' : 'px-3 py-3 pl-10')}>{typeof children === 'function' ? children(open) : children}</div>
552
809
  </Collapse>
@@ -555,17 +812,21 @@ function Disclosure({ summary, children, flush = false }: { summary: React.React
555
812
  }
556
813
 
557
814
  function WorkloadLinks({ workloads, onOpen, inline = false, exposure }: { workloads: VulnerabilityWorkloadRef[]; onOpen: (w: VulnerabilityWorkloadRef) => void; inline?: boolean; exposure?: ExposureLookup }) {
815
+ const owners = useOwners()
558
816
  return (
559
817
  <ul className={clsx('flex min-w-0', inline ? 'flex-wrap gap-x-4 gap-y-0.5' : 'flex-col gap-0.5')}>
560
818
  {workloads.map((w) => {
561
819
  const exposed = routesFor(exposure, w)
562
820
  return (
563
- <li key={`${w.namespace}/${w.kind}/${w.name}/${w.container ?? ''}`} className="flex min-w-0 items-baseline gap-1">
821
+ <li key={`${w.namespace}/${w.kind}/${w.name}/${w.container ?? ''}`} className="flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5">
564
822
  {exposed && <ExposedMark exposed={exposed} />}
565
- <button type="button" onClick={() => onOpen(w)} className="group flex min-w-0 items-baseline gap-1.5 text-left text-xs">
566
- <span className="truncate text-accent-text group-hover:underline">{w.name}</span>
567
- <span className="shrink-0 text-theme-text-tertiary">{w.kind} · {w.namespace}{w.container ? ` · ${w.container}` : ''}</span>
568
- </button>
823
+ <WithTooltip tip={ownerTip(owners?.find(w))}>
824
+ <button type="button" onClick={() => onOpen(w)} className="group flex min-w-0 items-baseline gap-1.5 text-left text-xs">
825
+ <span className="truncate text-accent-text group-hover:underline">{w.name}</span>
826
+ <span className="shrink-0 text-theme-text-tertiary">{w.kind} · {w.namespace}{w.container ? ` · ${w.container}` : ''}</span>
827
+ </button>
828
+ </WithTooltip>
829
+ <WorkloadRiskBadge workload={w} className="self-center" />
569
830
  </li>
570
831
  )
571
832
  })}
@@ -573,6 +834,54 @@ function WorkloadLinks({ workloads, onOpen, inline = false, exposure }: { worklo
573
834
  )
574
835
  }
575
836
 
837
+ // An expanded image's workloads, under the row's Workloads column.
838
+ function AffectedWorkloads({ workloads, total, onOpen, exposure }: { workloads: VulnerabilityWorkloadRef[]; total: number; onOpen: (w: VulnerabilityWorkloadRef) => void; exposure?: ExposureLookup }) {
839
+ return (
840
+ <span className="flex min-w-0 flex-wrap items-baseline gap-x-4">
841
+ <WorkloadLinks workloads={workloads} onOpen={onOpen} inline exposure={exposure} />
842
+ {total > workloads.length && <span className="text-theme-text-tertiary">and {total - workloads.length} more</span>}
843
+ </span>
844
+ )
845
+ }
846
+
847
+ const MAX_CONTAINER_LINES = 2
848
+
849
+ function containerText(c: VulnerabilityWorkload['containers'][number]): string {
850
+ const counts = c.scanned && c.counts
851
+ ? totalFindings(c.counts) === 0 ? 'no reported CVEs' : SEVERITY_FILTERS.filter((s) => c.counts![s.key] > 0).map((s) => `${c.counts![s.key]} ${s.label}`).join(', ')
852
+ : c.findingsUnread ? 'findings not read' : 'not scanned yet'
853
+ return `${c.name} (${imageParts(c.image).name}): ${counts}`
854
+ }
855
+
856
+ // A workload's containers, two lines at most: past two, the first and how
857
+ // many more, with each one on hover.
858
+ function WorkloadContainers({ containers }: { containers: VulnerabilityWorkload['containers'] }) {
859
+ const shown = containers.length > MAX_CONTAINER_LINES ? containers.slice(0, 1) : containers
860
+ const rest = containers.slice(shown.length)
861
+ const restTip = rest.map(containerText).join('. ')
862
+ const restTarget = useTipTarget(`${rest.length} more containers: ${restTip}`)
863
+ return (
864
+ <ul className="flex min-w-0 flex-col gap-1">
865
+ {shown.map((c) => (
866
+ <li key={`${c.name}/${c.image}`} className="flex min-w-0 items-baseline gap-x-2 text-xs">
867
+ <span className="shrink-0 text-theme-text-secondary">{c.name}</span>
868
+ <ImageName image={c.image} className="min-w-0 text-theme-text-tertiary" />
869
+ {c.scanned && c.counts ? <span className="shrink-0"><SeverityCounts counts={c.counts} /></span> : c.findingsUnread ? <span className="shrink-0 text-warning-text">findings not read</span> : <span className="shrink-0 text-warning-text">not scanned yet</span>}
870
+ </li>
871
+ ))}
872
+ {rest.length > 0 && (
873
+ <li className="flex text-xs">
874
+ <WithTooltip tip={restTip}>
875
+ <span className="text-theme-text-tertiary underline decoration-dotted underline-offset-2" {...restTarget}>
876
+ and {rest.length} more {rest.length === 1 ? 'container' : 'containers'}
877
+ </span>
878
+ </WithTooltip>
879
+ </li>
880
+ )}
881
+ </ul>
882
+ )
883
+ }
884
+
576
885
  function NumHead({ children }: { children: React.ReactNode }) {
577
886
  return <span className="text-right">{children}</span>
578
887
  }
@@ -581,12 +890,13 @@ function Num({ children, strong = false }: { children: React.ReactNode; strong?:
581
890
  return <span className={clsx('text-right font-mono text-xs tabular-nums', strong ? 'font-medium text-theme-text-primary' : 'text-theme-text-secondary')}>{children}</span>
582
891
  }
583
892
 
584
- function ImageTable({ images, onOpen, onOpenReport }: { images: VulnerableImage[]; onOpen: (w: VulnerabilityWorkloadRef) => void; onOpenReport: (img: VulnerableImage) => void }) {
893
+ function ImageTable({ images, columns, onOpen, onOpenReport }: { images: VulnerableImage[]; columns: Record<string, boolean>; onOpen: (w: VulnerabilityWorkloadRef) => void; onOpenReport: (img: VulnerableImage) => void }) {
894
+ const grid = imageGrid(columns)
585
895
  return (
586
896
  <div className="shrink-0 overflow-x-auto overflow-y-hidden rounded-lg border border-theme-border bg-theme-surface">
587
- <div className="min-w-[860px]">
588
- <div className={clsx(HEAD, IMAGE_COLS)}>
589
- <span>Image</span><span>Findings</span><NumHead>With a fix</NumHead><span>Running in</span><NumHead>Scanned</NumHead>
897
+ <div style={{ minWidth: 860 + (columns.os ? 156 : 0) + (columns.scanner ? 128 : 0) }}>
898
+ <div className={HEAD} style={grid}>
899
+ <span>Image</span>{columns.os && <OptionalHead column={optionalColumn('image', 'os')} />}<span>Findings</span><NumHead>With a fix</NumHead><span>Workloads</span>{columns.scanner && <OptionalHead column={optionalColumn('image', 'scanner')} />}<NumHead>Scanned</NumHead>
590
900
  </div>
591
901
  {images.map((img) => {
592
902
  const exposure = exposureLookup(img.exposed)
@@ -597,38 +907,43 @@ function ImageTable({ images, onOpen, onOpenReport }: { images: VulnerableImage[
597
907
  key={img.id}
598
908
  flush
599
909
  summary={
600
- <div className={clsx('grid flex-1 items-center gap-4 text-sm', IMAGE_COLS)}>
910
+ <div className="grid flex-1 items-center gap-4 text-sm" style={grid}>
601
911
  <span className="flex min-w-0 flex-col">
602
- <ImageName image={img.image} className="text-theme-text-primary" />
603
- <span className="truncate font-mono text-xs text-theme-text-tertiary">{[imageParts(img.image).path, img.os].filter(Boolean).join(' · ')}</span>
912
+ {/* The OS sits on the name's line, or in its column when that is on;
913
+ the badges follow, and the name gives way before them. */}
914
+ <span className="flex min-w-0 items-center gap-1.5">
915
+ <span className="flex min-w-0 items-baseline gap-1.5">
916
+ <ImageName image={img.image} digest={img.digest} className="text-theme-text-primary" />
917
+ {!columns.os && <OsLabel os={img.os} endOfLife={img.osEndOfLife} lead />}
918
+ </span>
919
+ {!img.findingsUnread && <KevCount count={img.kevCves} what="of its CVEs" />}
920
+ <RowRiskBadge factors={img.riskFactors} workloads={img.workloads} />
921
+ </span>
922
+ {imageParts(img.image).path && <span className="truncate font-mono text-xs text-theme-text-tertiary">{imageParts(img.image).path}</span>}
604
923
  </span>
924
+ {columns.os && (img.os || img.osEndOfLife ? <OsLabel os={img.os} endOfLife={img.osEndOfLife} /> : <span className="text-xs text-theme-text-tertiary">—</span>)}
605
925
  {img.findingsUnread ? <span className="text-xs text-warning-text">Findings not read</span> : <SeverityBar counts={img.counts} className="max-w-[280px]" />}
606
926
  <WithTooltip tip={img.findingsUnread ? undefined : `${fixable} of ${total} findings have a fixed release`}>
607
927
  <Num>{img.findingsUnread ? '—' : <>{fixable}<span className="text-theme-text-tertiary"> of {total}</span></>}</Num>
608
928
  </WithTooltip>
609
- <span className="flex min-w-0 flex-col">
610
- <WorkloadSummary workloads={img.workloads} exposure={exposure} suffix={img.workloadsTotal > img.workloads.length ? ` and ${img.workloadsTotal - img.workloads.length} more` : ''} />
611
- <span className="flex flex-wrap items-center gap-x-2 text-xs text-theme-text-tertiary">
612
- {namespaceCount(img)}
613
- <ExposedCount exposed={img.exposed} total={img.exposedTotal} unknown={img.exposureUnknown} />
614
- </span>
615
- </span>
929
+ <ImageWorkloads img={img} />
930
+ {columns.scanner && <span className="truncate text-xs text-theme-text-secondary">{img.scanner ? [img.scanner.name, img.scanner.version].filter(Boolean).join(' ') : '—'}</span>}
616
931
  <span className="text-right text-xs text-theme-text-tertiary">{formatRelativeAgeTime(img.scannedAt)}</span>
617
932
  </div>
618
933
  }
619
934
  >
620
- <div className={clsx('grid gap-4 py-1.5 pl-10 pr-3', IMAGE_COLS)}>
621
- <div className="col-span-3 flex min-w-0 flex-col gap-1.5">
935
+ <div className="grid gap-4 py-1.5 pl-10 pr-3" style={grid}>
936
+ <div className="flex min-w-0 flex-col gap-1.5" style={{ gridColumn: `span ${columns.os ? 4 : 3}` }}>
622
937
  <span className="text-xs font-medium text-theme-text-secondary">
623
938
  {img.matching === img.findingsTotal ? 'Findings, worst first' : `${img.matching} of ${img.findingsTotal} findings match`}
624
939
  </span>
625
- <FindingsList findings={img.findings} total={img.findingsTotal} unread={img.findingsUnread} />
940
+ <FindingsList findings={img.findings} total={img.findingsTotal} unread={img.findingsUnread} packageUrl={columns.packageUrl} />
626
941
  <span className="flex gap-3 text-xs">
627
942
  {img.matching > img.findings.length && <span className="text-theme-text-tertiary">{img.matching - img.findings.length} more in the report.</span>}
628
943
  <button type="button" onClick={() => onOpenReport(img)} className="text-accent-text hover:underline">Open the scan report</button>
629
944
  </span>
630
945
  </div>
631
- <div className="col-span-2 flex min-w-0 flex-col gap-1.5">
946
+ <div className="flex min-w-0 flex-col gap-1.5" style={{ gridColumn: `span ${columns.scanner ? 3 : 2}` }}>
632
947
  <span className="text-xs font-medium text-theme-text-secondary">{img.workloadsTotal} {img.workloadsTotal === 1 ? 'container' : 'containers'}{img.workloadsTotal > img.workloads.length ? ` (first ${img.workloads.length})` : ''}</span>
633
948
  <WorkloadLinks workloads={img.workloads} onOpen={onOpen} exposure={exposure} />
634
949
  </div>
@@ -641,14 +956,22 @@ function ImageTable({ images, onOpen, onOpenReport }: { images: VulnerableImage[
641
956
  )
642
957
  }
643
958
 
644
- // The listed workloads are capped, so past the cap their namespaces are a floor.
645
- function namespaceCount(img: VulnerableImage): string {
646
- const n = distinctNamespaces(img.workloads)
647
- const partial = img.workloadsTotal > img.workloads.length
648
- return `${partial ? 'at least ' : ''}${n} ${n === 1 ? 'namespace' : 'namespaces'}`
959
+ // An image's row counts containers, so its workloads are counted from the
960
+ // listed ones: past the list's cap that count is a floor.
961
+ function ImageWorkloads({ img }: { img: VulnerableImage }) {
962
+ const capped = img.workloadsTotal > img.workloads.length
963
+ return (
964
+ <WorkloadsCell
965
+ workloads={img.workloads}
966
+ capped={capped}
967
+ exposed={img.exposed}
968
+ exposedTotal={img.exposedTotal}
969
+ exposureUnknown={img.exposureUnknown}
970
+ />
971
+ )
649
972
  }
650
973
 
651
- function FindingsList({ findings, total, unread }: { findings: VulnerableImage['findings']; total: number; unread?: boolean }) {
974
+ function FindingsList({ findings, total, unread, packageUrl }: { findings: VulnerableImage['findings']; total: number; unread?: boolean; packageUrl?: boolean }) {
652
975
  if (unread) {
653
976
  return <span className="text-xs text-warning-text">Not read: this request reached its findings limit before this image. Narrow with the namespace picker.</span>
654
977
  }
@@ -657,29 +980,45 @@ function FindingsList({ findings, total, unread }: { findings: VulnerableImage['
657
980
  }
658
981
  return (
659
982
  <div className="flex flex-col divide-y divide-theme-border border-y border-theme-border">
983
+ {packageUrl && (
984
+ <div className={clsx('grid items-center gap-3 py-1 text-[11px] font-semibold uppercase tracking-wider text-theme-text-tertiary', FINDING_COLS_PURL)}>
985
+ <span>CVE</span><span>Severity</span><span>Package</span><span>Fix</span><OptionalHead column={optionalColumn('image', 'packageUrl')} />
986
+ </div>
987
+ )}
660
988
  {findings.map((f, i) => (
661
- <div key={`${f.id}/${f.package}/${f.installedVersion}/${i}`} className="grid grid-cols-[136px_72px_minmax(0,0.8fr)_minmax(0,1.4fr)] items-center gap-3 py-1 text-xs">
662
- {f.link ? (
663
- <WithTooltip tip={f.title}><a href={f.link} target="_blank" rel="noreferrer" className="truncate font-mono text-accent-text hover:underline">{f.id}</a></WithTooltip>
664
- ) : (
665
- <WithTooltip tip={f.title}><span className="truncate font-mono text-theme-text-primary">{f.id}</span></WithTooltip>
666
- )}
667
- <SeverityBadge severity={f.severity} fromScore={f.severityFromScore} score={f.score} />
989
+ <div key={`${f.id}/${f.package}/${f.installedVersion}/${i}`} className={clsx('grid items-center gap-3 py-1 text-xs', packageUrl ? FINDING_COLS_PURL : FINDING_COLS)}>
990
+ <span className="flex min-w-0 items-center gap-1">
991
+ {f.link ? (
992
+ <WithTooltip tip={f.title}><a href={f.link} target="_blank" rel="noreferrer" className="truncate font-mono text-accent-text hover:underline">{f.id}</a></WithTooltip>
993
+ ) : (
994
+ <WithTooltip tip={f.title}><span className="truncate font-mono text-theme-text-primary">{f.id}</span></WithTooltip>
995
+ )}
996
+ <KevBadge kev={f.kev} />
997
+ </span>
998
+ <SeverityText severity={f.severity} fromScore={f.severityFromScore} score={f.score} />
668
999
  <span className="truncate font-mono text-theme-text-secondary">{f.package}</span>
669
1000
  <FixVersion installed={f.installedVersion} fixed={f.fixedVersion} target={f.fixTarget} />
1001
+ {packageUrl && (
1002
+ <WithTooltip tip={f.packageUrl}>
1003
+ <span className="truncate font-mono text-theme-text-tertiary">{f.packageUrl || '—'}</span>
1004
+ </WithTooltip>
1005
+ )}
670
1006
  </div>
671
1007
  ))}
672
1008
  </div>
673
1009
  )
674
1010
  }
675
1011
 
1012
+ const FINDING_COLS = 'grid-cols-[minmax(136px,auto)_72px_minmax(0,0.8fr)_minmax(0,1.4fr)]'
1013
+ const FINDING_COLS_PURL = 'grid-cols-[minmax(136px,auto)_72px_minmax(0,0.8fr)_minmax(0,1.4fr)_minmax(0,1fr)]'
1014
+
676
1015
  function FixTable({ fixes, onOpen, onShowCVE }: { fixes: VulnerabilityFix[]; onOpen: (w: VulnerabilityWorkloadRef) => void; onShowCVE: (id: string) => void }) {
677
1016
  return (
678
1017
  <div className="flex shrink-0 flex-col gap-2">
679
1018
  <div className="overflow-x-auto overflow-y-hidden rounded-lg border border-theme-border bg-theme-surface">
680
1019
  <div className="min-w-[960px]">
681
1020
  <div className={clsx(HEAD, FIX_COLS)}>
682
- <span>Package</span><WithTooltip tip="Upgrading a package means rebuilding the image that holds it."><span className="self-start underline decoration-dotted underline-offset-2">Upgrade</span></WithTooltip><span>Clears</span><span>Running in</span><NumHead>Images</NumHead><NumHead>Workloads</NumHead>
1021
+ <span>Package</span><WithTooltip tip="Upgrading a package means rebuilding the image that holds it."><span className="self-start underline decoration-dotted underline-offset-2">Upgrade</span></WithTooltip><span>Clears</span><NumHead>Images</NumHead><span>Workloads</span>
683
1022
  </div>
684
1023
  {fixes.map((f) => {
685
1024
  const runners = f.affected.flatMap((a) => a.workloads)
@@ -692,7 +1031,11 @@ function FixTable({ fixes, onOpen, onShowCVE }: { fixes: VulnerabilityFix[]; onO
692
1031
  summary={
693
1032
  <div className={clsx('grid flex-1 items-center gap-4 text-sm', FIX_COLS)}>
694
1033
  <span className="flex min-w-0 flex-col">
695
- <span className="truncate font-mono text-theme-text-primary">{f.package}</span>
1034
+ <span className="flex min-w-0 items-center gap-1.5">
1035
+ <span className="truncate font-mono text-theme-text-primary">{f.package}</span>
1036
+ <KevCount count={f.kevCves} what="of the CVEs it clears" />
1037
+ <RowRiskBadge factors={f.riskFactors} workloads={runners} />
1038
+ </span>
696
1039
  {f.packageType && <span className="truncate text-xs text-theme-text-tertiary">{ecosystemLabel(f.packageType)}</span>}
697
1040
  </span>
698
1041
  <WithTooltip tip={f.to ? `${f.from.join(', ')} → ${f.to}` : "Radar can't pick one release that fixes every CVE here: it can't order this package's versions, or no listed release is above the installed one. These are the fixed releases the scanner lists."}>
@@ -706,18 +1049,20 @@ function FixTable({ fixes, onOpen, onShowCVE }: { fixes: VulnerabilityFix[]; onO
706
1049
  </span>
707
1050
  </WithTooltip>
708
1051
  <SeverityCounts counts={f.counts} />
709
- <WorkloadSummary workloads={runners} exposure={exposure} />
710
1052
  <Num>{f.images}</Num>
711
- <span className="flex flex-col items-end">
712
- <Num strong>{f.workloads}</Num>
713
- <ExposedCount exposed={f.exposed} total={f.exposedTotal} workloads={f.workloads} unknown={f.exposureUnknown} />
714
- </span>
1053
+ <WorkloadsCell
1054
+ workloads={runners}
1055
+ total={f.workloads}
1056
+ exposed={f.exposed}
1057
+ exposedTotal={f.exposedTotal}
1058
+ exposureUnknown={f.exposureUnknown}
1059
+ />
715
1060
  </div>
716
1061
  }
717
1062
  >
718
1063
  <div className={clsx(SUB, FIX_COLS)}>
719
1064
  <span className="text-theme-text-tertiary">{f.cvesTotal} {f.cvesTotal === 1 ? 'CVE' : 'CVEs'}{f.to ? ' cleared' : ''}</span>
720
- <span className="col-span-5 flex flex-wrap gap-1.5">
1065
+ <span className="col-span-4 flex flex-wrap gap-1.5">
721
1066
  {f.cves.map((id) => (
722
1067
  <button key={id} type="button" onClick={() => onShowCVE(id)} className="badge-sm bg-theme-elevated font-mono text-theme-text-secondary hover:bg-theme-hover hover:text-theme-text-primary">{id}</button>
723
1068
  ))}
@@ -729,9 +1074,8 @@ function FixTable({ fixes, onOpen, onShowCVE }: { fixes: VulnerabilityFix[]; onO
729
1074
  <ImageName image={a.image} className="text-theme-text-primary" />
730
1075
  <span className="truncate font-mono text-theme-text-tertiary">{several ? a.installedVersions.join(', ') : ''}</span>
731
1076
  <span />
732
- <WorkloadLinks workloads={a.workloads} onOpen={onOpen} inline exposure={exposure} />
733
1077
  <span />
734
- <Num>{a.workloadsTotal}</Num>
1078
+ <AffectedWorkloads workloads={a.workloads} total={a.workloadsTotal} onOpen={onOpen} exposure={exposure} />
735
1079
  </div>
736
1080
  ))}
737
1081
  {f.images > f.affected.length && <p className={clsx(SUB, 'text-theme-text-tertiary')}>{f.images - f.affected.length} more images.</p>}
@@ -744,13 +1088,20 @@ function FixTable({ fixes, onOpen, onShowCVE }: { fixes: VulnerabilityFix[]; onO
744
1088
  )
745
1089
  }
746
1090
 
747
- function CVETable({ cves, onOpen }: { cves: VulnerabilityCVE[]; onOpen: (w: VulnerabilityWorkloadRef) => void }) {
1091
+ function CVETable({ cves, columns, intel, onOpen }: { cves: VulnerabilityCVE[]; columns: Record<string, boolean>; intel?: VulnerabilityIntel; onOpen: (w: VulnerabilityWorkloadRef) => void }) {
1092
+ const grid = cveGrid(columns)
1093
+ const extra = (columns.published ? 1 : 0) + (columns.age ? 1 : 0) + (columns.epss ? 1 : 0)
1094
+ const now = Date.now()
748
1095
  return (
749
1096
  <div className="flex shrink-0 flex-col gap-2">
750
1097
  <div className="shrink-0 overflow-x-auto overflow-y-hidden rounded-lg border border-theme-border bg-theme-surface">
751
- <div className="min-w-[960px]">
752
- <div className={clsx(HEAD, CVE_COLS)}>
753
- <span>CVE</span><span>Severity</span><NumHead>Score</NumHead><span>Package</span><span>Fix</span><NumHead>Images</NumHead><NumHead>Workloads</NumHead>
1098
+ <div style={{ minWidth: 1080 + (columns.published ? 108 : 0) + (columns.age ? 92 : 0) + (columns.epss ? 80 : 0) }}>
1099
+ <div className={HEAD} style={grid}>
1100
+ <span>CVE</span><span>Severity</span><NumHead>Score</NumHead>
1101
+ {columns.epss && <span className="justify-self-end"><OptionalHead column={optionalColumn('cve', 'epss')} /></span>}
1102
+ {columns.published && <OptionalHead column={optionalColumn('cve', 'published')} />}
1103
+ {columns.age && <OptionalHead column={optionalColumn('cve', 'age')} align="right" />}
1104
+ <span>Package</span><span>Fix</span><NumHead>Images</NumHead><span>Workloads</span>
754
1105
  </div>
755
1106
  {cves.map((c) => {
756
1107
  const exposure = exposureLookup(c.exposed)
@@ -759,30 +1110,37 @@ function CVETable({ cves, onOpen }: { cves: VulnerabilityCVE[]; onOpen: (w: Vuln
759
1110
  key={c.id}
760
1111
  flush
761
1112
  summary={
762
- <div className={clsx('grid flex-1 items-center gap-4 text-sm', CVE_COLS)}>
1113
+ <div className="grid flex-1 items-center gap-4 text-sm" style={grid}>
763
1114
  <span className="flex min-w-0 flex-col">
764
- <span className="truncate font-mono text-theme-text-primary">{c.id}</span>
1115
+ <span className="flex min-w-0 items-center gap-1.5">
1116
+ <span className="truncate font-mono text-theme-text-primary">{c.id}</span>
1117
+ <KevBadge kev={c.kev} />
1118
+ <RowRiskBadge factors={c.riskFactors} workloads={c.affected.flatMap((a) => a.workloads)} />
1119
+ </span>
765
1120
  {c.title && <span className="truncate text-xs text-theme-text-tertiary">{c.title}</span>}
766
1121
  </span>
767
- <SeverityBadge severity={c.severity} />
1122
+ <SeverityText severity={c.severity} />
768
1123
  <Num>{c.score?.toFixed(1) ?? '—'}</Num>
1124
+ {columns.epss && <span className="text-right text-xs"><EpssValue epss={c.epss} feed={intel?.epss} /></span>}
1125
+ {columns.published && <PublishedDate at={c.publishedAt} now={now} />}
1126
+ {columns.age && <CVEAge at={c.publishedAt} now={now} />}
769
1127
  <span className="truncate font-mono text-xs text-theme-text-secondary">{c.packages.join(', ')}</span>
770
1128
  <CVEFix cve={c} />
771
1129
  <Num>{c.images}</Num>
772
- <span className="flex flex-col items-end">
773
- <Num strong>{c.workloads}</Num>
774
- <ExposedCount exposed={c.exposed} total={c.exposedTotal} workloads={c.workloads} unknown={c.exposureUnknown} />
775
- </span>
1130
+ <WorkloadsCell
1131
+ workloads={c.affected.flatMap((a) => a.workloads)}
1132
+ total={c.workloads}
1133
+ exposed={c.exposed}
1134
+ exposedTotal={c.exposedTotal}
1135
+ exposureUnknown={c.exposureUnknown}
1136
+ />
776
1137
  </div>
777
1138
  }
778
1139
  >
779
1140
  {c.affected.map((a) => (
780
- <div key={a.imageId} className={clsx(SUB, CVE_COLS)}>
781
- <span className="flex min-w-0 flex-col gap-0.5">
782
- <ImageName image={a.image} className="text-theme-text-primary" />
783
- <WorkloadLinks workloads={a.workloads} onOpen={onOpen} inline exposure={exposure} />
784
- </span>
785
- <span className="col-span-2" />
1141
+ <div key={a.imageId} className={SUB} style={grid}>
1142
+ <ImageName image={a.image} className="text-theme-text-primary" />
1143
+ <span style={{ gridColumn: `span ${2 + extra}` }} />
786
1144
  <span className="col-span-2 flex min-w-0 flex-col">
787
1145
  {a.packages.map((p) => (
788
1146
  <span key={`${p.package}/${p.installedVersion}`} className="flex min-w-0 gap-1.5">
@@ -792,7 +1150,7 @@ function CVETable({ cves, onOpen }: { cves: VulnerabilityCVE[]; onOpen: (w: Vuln
792
1150
  ))}
793
1151
  </span>
794
1152
  <span />
795
- <Num>{a.workloadsTotal}</Num>
1153
+ <AffectedWorkloads workloads={a.workloads} total={a.workloadsTotal} onOpen={onOpen} exposure={exposure} />
796
1154
  </div>
797
1155
  ))}
798
1156
  <div className={clsx(SUB, 'flex gap-4')}>
@@ -808,8 +1166,10 @@ function CVETable({ cves, onOpen }: { cves: VulnerabilityCVE[]; onOpen: (w: Vuln
808
1166
  )
809
1167
  }
810
1168
 
811
- function WorkloadTable({ workloads, exposure, severities, query, namespaces, onOpen, onShow }: {
1169
+ function WorkloadTable({ workloads, columns, exposure, severities, query, namespaces, onOpen, onShow }: {
812
1170
  workloads: VulnerabilityWorkload[]
1171
+ /** Its optional columns that are on. */
1172
+ columns: Record<string, boolean>
813
1173
  /** Absent from an older Radar: the route column is left out, not shown empty. */
814
1174
  exposure: VulnerabilitiesResponse['exposure']
815
1175
  severities: VulnerabilitySeverity[]
@@ -819,38 +1179,35 @@ function WorkloadTable({ workloads, exposure, severities, query, namespaces, onO
819
1179
  onOpen: (w: VulnerabilityWorkloadRef) => void
820
1180
  onShow: (w: VulnerabilityWorkloadRef, by: VulnerabilityView) => void
821
1181
  }) {
822
- const cols = exposure ? WORKLOAD_ROUTE_COLS : WORKLOAD_COLS
1182
+ const grid = workloadGrid(!!exposure, columns)
823
1183
  return (
824
1184
  <div className="shrink-0 overflow-x-auto overflow-y-hidden rounded-lg border border-theme-border bg-theme-surface">
825
- <div className={exposure ? 'min-w-[920px]' : 'min-w-[760px]'}>
826
- <div className={clsx(HEAD, cols)}>
827
- <span>Workload</span><span>Findings across its images</span>{exposure && <span>{EXPOSURE.column}</span>}<span>Containers</span>
1185
+ <div style={{ minWidth: (exposure ? 920 : 760) + (columns.owner ? 176 : 0) }}>
1186
+ <div className={HEAD} style={grid}>
1187
+ <span>Workload</span>{columns.owner && <OptionalHead column={optionalColumn('workload', 'owner')} />}<span>Findings across its images</span>{exposure && <span>{EXPOSURE.column}</span>}<span>Containers</span>
828
1188
  </div>
829
1189
  {workloads.map((w) => (
830
1190
  <Disclosure
831
1191
  key={`${w.namespace}/${w.kind}/${w.name}`}
832
1192
  flush
833
1193
  summary={
834
- <div className={clsx('grid flex-1 items-start gap-4 text-sm', cols)}>
835
- <span className="flex min-w-0 flex-col">
836
- <span className="truncate text-theme-text-primary">{w.name}</span>
837
- <span className="text-xs text-theme-text-tertiary">{w.kind} · {w.namespace}</span>
1194
+ <div className="grid flex-1 items-start gap-4 text-sm" style={grid}>
1195
+ <span className="flex min-w-0 flex-col gap-0.5">
1196
+ <span className="flex min-w-0 items-center gap-1.5">
1197
+ <span className="truncate text-theme-text-primary">{w.name}</span>
1198
+ <KevCount count={w.kevCves} what="of the CVEs in its images" />
1199
+ <WorkloadRiskBadge workload={w} />
1200
+ </span>
1201
+ <span className="truncate text-xs text-theme-text-tertiary">{w.kind} · {w.namespace}</span>
838
1202
  </span>
1203
+ {columns.owner && <OwnerCell workload={w} />}
839
1204
  <WorkloadFindings workload={w} />
840
1205
  {exposure && <WorkloadRoute workload={w} gaps={exposure.gaps} />}
841
- <ul className="flex min-w-0 flex-col gap-1">
842
- {w.containers.map((c) => (
843
- <li key={`${c.name}/${c.image}`} className="flex min-w-0 flex-wrap items-baseline gap-x-2 text-xs">
844
- <span className="shrink-0 text-theme-text-secondary">{c.name}</span>
845
- <ImageName image={c.image} className="text-theme-text-tertiary" />
846
- {c.scanned && c.counts ? <SeverityCounts counts={c.counts} /> : c.findingsUnread ? <span className="text-warning-text">findings not read</span> : <span className="text-warning-text">not scanned yet</span>}
847
- </li>
848
- ))}
849
- </ul>
1206
+ <WorkloadContainers containers={w.containers} />
850
1207
  </div>
851
1208
  }
852
1209
  >
853
- {(open) => <WorkloadUpgrades workload={w} routeColumn={!!exposure} active={open} severities={severities} query={query} namespaces={namespaces} onOpen={onOpen} onShow={onShow} />}
1210
+ {(open) => <WorkloadUpgrades workload={w} grid={grid} ownerColumn={!!columns.owner} routeColumn={!!exposure} active={open} severities={severities} query={query} namespaces={namespaces} onOpen={onOpen} onShow={onShow} />}
854
1211
  </Disclosure>
855
1212
  ))}
856
1213
  </div>
@@ -883,6 +1240,23 @@ function WorkloadRoute({ workload: w, gaps }: { workload: VulnerabilityWorkload;
883
1240
  return <span />
884
1241
  }
885
1242
 
1243
+ // Days since the CVE was published; a dash when Trivy gave no readable date.
1244
+ function CVEAge({ at, now }: { at?: string; now: number }) {
1245
+ const days = at ? daysSince(at, now) : undefined
1246
+ return <Num>{days === undefined ? '—' : `${days.toLocaleString('en-US')} d`}</Num>
1247
+ }
1248
+
1249
+ // The CVE's publication date; its age, which is not how long it has been
1250
+ // here, is in the tooltip.
1251
+ function PublishedDate({ at, now }: { at?: string; now: number }) {
1252
+ const days = at ? daysSince(at, now) : undefined
1253
+ return (
1254
+ <WithTooltip tip={days === undefined ? undefined : `Published ${days.toLocaleString('en-US')} ${days === 1 ? 'day' : 'days'} ago. That is the CVE's age, not how long it has been in this cluster.`}>
1255
+ <span className="font-mono text-xs tabular-nums text-theme-text-secondary">{at ? isoDate(at) : '—'}</span>
1256
+ </WithTooltip>
1257
+ )
1258
+ }
1259
+
886
1260
  // Whether an upgrade clears the CVE: in every image, some, or none.
887
1261
  function CVEFix({ cve: c }: { cve: VulnerabilityCVE }) {
888
1262
  const all = c.fixableImages >= c.images
@@ -900,8 +1274,11 @@ const MAX_WORKLOAD_UPGRADES = 8
900
1274
 
901
1275
  // What a workload's owner changes: the By fix rows narrowed to this
902
1276
  // workload, read when the row opens.
903
- function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query, namespaces, onOpen, onShow }: {
1277
+ function WorkloadUpgrades({ workload: w, grid, ownerColumn, routeColumn, active, severities, query, namespaces, onOpen, onShow }: {
904
1278
  workload: VulnerabilityWorkload
1279
+ /** The table's columns; sub-rows keep a cell for the owner column too. */
1280
+ grid: React.CSSProperties
1281
+ ownerColumn: boolean
905
1282
  /** The table shows the route column; sub-rows keep a cell for it so detail lines up. */
906
1283
  routeColumn: boolean
907
1284
  /** False once the row closes: its subtree stays mounted, its polling stops. */
@@ -914,8 +1291,9 @@ function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query,
914
1291
  onShow: (w: VulnerabilityWorkloadRef, by: VulnerabilityView) => void
915
1292
  }) {
916
1293
  const ref = { kind: w.kind, group: w.group, namespace: w.namespace, name: w.name }
917
- const cols = routeColumn ? WORKLOAD_ROUTE_COLS : WORKLOAD_COLS
1294
+ const ownerLine = ownerTip(useOwners()?.find(ref))
918
1295
  const routeCell = routeColumn && <span />
1296
+ const ownerCell = ownerColumn && <span />
919
1297
  // The row's own scope: the newest report for an image wins across every
920
1298
  // namespace read, so a narrower read could pick an older one.
921
1299
  const { data, isLoading, error } = useVulnerabilities({ view: 'fix', namespaces, severities, query, workload: ref }, active)
@@ -931,6 +1309,9 @@ function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query,
931
1309
  <button type="button" onClick={() => onOpen(ref)} className="text-accent-text hover:underline">Open {w.name}</button>
932
1310
  {total > 0 && <button type="button" onClick={() => onShow(ref, 'cve')} className="text-accent-text hover:underline">{filtered ? 'Its CVEs' : 'All its CVEs'}</button>}
933
1311
  {fixes.length > MAX_WORKLOAD_UPGRADES && <button type="button" onClick={() => onShow(ref, 'fix')} className="text-accent-text hover:underline">All {fixes.length} upgrades</button>}
1312
+ {/* Here, with the workload's other actions, rather than on the row
1313
+ the user clicks to open and close. */}
1314
+ {(w.routes?.length ?? 0) > 0 && <SeeTrafficLink workload={ref} />}
934
1315
  </span>
935
1316
  )
936
1317
  let lead: React.ReactNode
@@ -951,12 +1332,13 @@ function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query,
951
1332
  )
952
1333
  return (
953
1334
  <>
954
- <div className={clsx(SUB, cols)}>
1335
+ <div className={SUB} style={grid}>
955
1336
  <span className="col-span-full">{lead}</span>
956
1337
  </div>
957
1338
  {fixes.length > 0 && (
958
- <div className={clsx(SUB, cols, 'text-theme-text-tertiary')}>
1339
+ <div className={clsx(SUB, 'text-theme-text-tertiary')} style={grid}>
959
1340
  <span />
1341
+ {ownerCell}
960
1342
  <span className="grid min-w-0 grid-cols-[1.75rem_2.25rem_minmax(0,1fr)] gap-2">
961
1343
  <span className="text-right">C</span><span className="text-right">H</span><span>Upgrade</span>
962
1344
  </span>
@@ -965,11 +1347,12 @@ function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query,
965
1347
  </div>
966
1348
  )}
967
1349
  {fixes.slice(0, MAX_WORKLOAD_UPGRADES).map((f) => (
968
- <div key={`${f.packageType ?? ''}/${f.package}/${f.to ?? (f.fixedVersions ?? []).join('|')}`} className={clsx(SUB, cols)}>
1350
+ <div key={`${f.packageType ?? ''}/${f.package}/${f.to ?? (f.fixedVersions ?? []).join('|')}`} className={SUB} style={grid}>
969
1351
  <span className="flex min-w-0 items-baseline gap-2">
970
1352
  <span className="truncate font-mono text-theme-text-primary">{f.package}</span>
971
1353
  {f.packageType && <span className="truncate text-theme-text-tertiary">{ecosystemLabel(f.packageType)}</span>}
972
1354
  </span>
1355
+ {ownerCell}
973
1356
  {/* Critical and High cleared, in fixed columns so rows line up. */}
974
1357
  <span className="grid min-w-0 grid-cols-[1.75rem_2.25rem_minmax(0,1fr)] items-baseline gap-2">
975
1358
  <ClearedCount count={f.counts.critical} severity="critical" />
@@ -984,6 +1367,7 @@ function WorkloadUpgrades({ workload: w, routeColumn, active, severities, query,
984
1367
  </span>
985
1368
  </div>
986
1369
  ))}
1370
+ {ownerLine && <div className={clsx(SUB, 'flex text-theme-text-secondary')}>{ownerLine}</div>}
987
1371
  <div className={clsx(SUB, 'flex')}>{actions}</div>
988
1372
  </>
989
1373
  )
@@ -1003,19 +1387,26 @@ function WorkloadFindings({ workload }: { workload: VulnerabilityWorkload }) {
1003
1387
  unread > 0 && `${containers(unread)} with findings not read`,
1004
1388
  ].filter(Boolean).join(', ')
1005
1389
  return (
1006
- <div className="flex min-w-0 flex-col gap-1">
1390
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
1007
1391
  <SeverityBar counts={workload.counts} className="max-w-[280px]" />
1008
1392
  {notCounted && <span className="text-xs text-warning-text">Not counted: {notCounted}</span>}
1009
1393
  </div>
1010
1394
  )
1011
1395
  }
1012
1396
 
1397
+ // How many scanned images (By image) or workloads (By workload) the clean
1398
+ // fold lists, those past the answer's cap included; 0 in the other views.
1399
+ function cleanCount(data: VulnerabilitiesResponse, view: VulnerabilityView): number {
1400
+ const listed = view === 'image' ? (data.clean ?? []).length : view === 'workload' ? (data.cleanWorkloads ?? []).length : 0
1401
+ return listed === 0 ? 0 : listed + (data.coverage.cleanOmitted ?? 0)
1402
+ }
1403
+
1013
1404
  // Scanned and clean, folded away so the rows are the ones that need work.
1014
1405
  function CleanList({ data, view, onOpen }: { data: VulnerabilitiesResponse; view: VulnerabilityView; onOpen: (w: VulnerabilityWorkloadRef) => void }) {
1015
1406
  const images = view === 'image' ? data.clean ?? [] : []
1016
1407
  const workloads = view === 'workload' ? data.cleanWorkloads ?? [] : []
1017
- if (images.length + workloads.length === 0) return null
1018
- const count = images.length + workloads.length + (data.coverage.cleanOmitted ?? 0)
1408
+ const count = cleanCount(data, view)
1409
+ if (count === 0) return null
1019
1410
  return (
1020
1411
  <div className="shrink-0 rounded-lg border border-theme-border bg-theme-surface">
1021
1412
  <Disclosure
@@ -1035,6 +1426,7 @@ function CleanList({ data, view, onOpen }: { data: VulnerabilitiesResponse; view
1035
1426
  <li key={c.id} className={FOLD_ROW}>
1036
1427
  <span className="flex min-w-0 items-baseline gap-2">
1037
1428
  <ImageName image={c.image} className="text-theme-text-primary" />
1429
+ {c.osEndOfLife && <EndOfLifeNote lead />}
1038
1430
  <span className="shrink-0 text-theme-text-tertiary">scanned {formatRelativeAgeTime(c.scannedAt)}</span>
1039
1431
  </span>
1040
1432
  <span className="flex min-w-0 flex-wrap items-baseline gap-x-4">
@@ -1091,3 +1483,51 @@ function UnscannedList({ data, onOpen }: { data: VulnerabilitiesResponse; onOpen
1091
1483
  </div>
1092
1484
  )
1093
1485
  }
1486
+
1487
+ // Why a link's Known exploited filter can't be applied. Without intel (an
1488
+ // older Radar, or one without Radar Cloud) the reason names no product.
1489
+ function kevNotAppliedReason(intel?: VulnerabilityIntel): string {
1490
+ return (intel && feedNote('KEV', intel.kev)) || KEV.noCatalog
1491
+ }
1492
+
1493
+ // The Known exploited chip, on a Radar that gets KEV from Radar Cloud.
1494
+ // Without the catalog it can't filter: it stays visible, inert, and says
1495
+ // why, so a cluster without it never reads as one with no known exploited
1496
+ // CVEs.
1497
+ function KnownExploitedChip({ intel, active, count, onClick }: { intel: VulnerabilityIntel; active: boolean; count?: number; onClick: () => void }) {
1498
+ if (!feedReady(intel.kev)) {
1499
+ // No catalog: a quiet, inert chip that says why, never one that reads
1500
+ // as an error or as "none".
1501
+ if (intel.kev.state === 'loading') {
1502
+ return (
1503
+ <span className="inline-flex items-center gap-1.5 rounded-md border border-dashed border-theme-border-light px-2.5 py-1 text-xs font-medium text-theme-text-tertiary">
1504
+ <KEV.icon className="h-3.5 w-3.5" aria-hidden />
1505
+ {KEV.loading}
1506
+ </span>
1507
+ )
1508
+ }
1509
+ const tip = feedNote('KEV', intel.kev) ?? ''
1510
+ return (
1511
+ <WithTooltip tip={tip}>
1512
+ <span tabIndex={0} aria-label={`${KEV.chip}: ${tip}`} className="inline-flex items-center gap-1.5 rounded-md border border-dashed border-theme-border-light px-2.5 py-1 text-xs font-medium text-theme-text-tertiary">
1513
+ <KEV.icon className="h-3.5 w-3.5" aria-hidden />
1514
+ {KEV.chip}<span className="font-normal">· {KEV.noData}</span>
1515
+ </span>
1516
+ </WithTooltip>
1517
+ )
1518
+ }
1519
+ // A copy that couldn't be refreshed for days still filters, with a warning.
1520
+ const status = feedStatusText(intel, (iso) => formatRelativeAgeTime(iso))
1521
+ return (
1522
+ <FilterPill
1523
+ label={KEV.chip}
1524
+ icon={intel.kev.stale ? AlertTriangle : KEV.icon}
1525
+ tone="danger"
1526
+ count={count}
1527
+ tooltip={[KEV.chipTip, KEV.countTip, status].filter(Boolean).join(' ')}
1528
+ active={active}
1529
+ onClick={onClick}
1530
+ className={intel.kev.stale && !active ? 'text-warning-text' : undefined}
1531
+ />
1532
+ )
1533
+ }