@skyhook-io/radar-app 1.21.0 → 1.21.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.
- package/package.json +1 -1
- package/src/App.tsx +13 -5
- package/src/api/radarFeatures.ts +4 -0
- package/src/api/velero.ts +176 -0
- package/src/api/vulnerabilities.ts +58 -0
- package/src/components/audit/ChecksViewTabs.test.tsx +4 -2
- package/src/components/audit/ChecksViewTabs.tsx +3 -2
- package/src/components/audit/Java4ShellPanel.test.tsx +31 -0
- package/src/components/audit/Java4ShellPanel.tsx +313 -0
- package/src/components/audit/VulnerabilitiesView.tsx +46 -9
- package/src/components/gitops/FluxOperatorCard.test.tsx +37 -0
- package/src/components/gitops/FluxOperatorCard.tsx +27 -0
- package/src/components/gitops/GitOpsView.rowsSummary.test.tsx +59 -0
- package/src/components/gitops/GitOpsView.tsx +7 -4
- package/src/components/gitops/gitopsRowEvents.test.ts +48 -0
- package/src/components/gitops/gitopsRowEvents.ts +31 -0
- package/src/components/velero/VeleroDetailPage.tsx +12 -2
- package/src/components/velero/VeleroRunArtifacts.test.tsx +241 -0
- package/src/components/velero/VeleroRunArtifacts.tsx +112 -0
- package/src/components/velero/VeleroRunVolumes.test.tsx +247 -0
- package/src/components/velero/VeleroRunVolumes.tsx +122 -0
- package/src/components/velero/VeleroSchedulePause.test.tsx +211 -0
- package/src/components/velero/VeleroSchedulePause.tsx +191 -0
- package/src/components/velero/host.tsx +9 -3
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +20 -8
- package/src/components/whats-new/WhatsNewDialog.test.tsx +6 -4
- package/src/components/whats-new/releaseNotes.ts +67 -1
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -26,6 +26,7 @@ import { CostView } from './components/cost/CostView'
|
|
|
26
26
|
import { AuditView } from './components/audit/AuditView'
|
|
27
27
|
import { IssuesPane } from './components/issues/IssuesPane'
|
|
28
28
|
import { GitOpsView } from './components/gitops/GitOpsView'
|
|
29
|
+
import { gitopsTableChange } from './components/gitops/gitopsRowEvents'
|
|
29
30
|
import { ApplicationsView } from './components/applications/ApplicationsView'
|
|
30
31
|
import { HelmReleaseDrawer } from './components/helm/HelmReleaseDrawer'
|
|
31
32
|
import { PortForwardProvider, PortForwardIndicator, PortForwardPanel } from './components/portforward/PortForwardManager'
|
|
@@ -1152,8 +1153,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1152
1153
|
const veleroInvalidationPendingRef = useRef(false)
|
|
1153
1154
|
const slowInvalidationRef = useRef<{
|
|
1154
1155
|
updatedKinds: Set<string> // update-only churn → throttled list + dashboard
|
|
1156
|
+
gitopsRowsChanged: boolean // Argo/Flux row and source kinds → GitOps table rows
|
|
1157
|
+
gitopsCountsChanged: boolean // add/delete in a GitOps group → GitOps table totals
|
|
1155
1158
|
timer: number | null
|
|
1156
|
-
}>({ updatedKinds: new Set(), timer: null })
|
|
1159
|
+
}>({ updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null })
|
|
1157
1160
|
const timelineInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
1158
1161
|
|
|
1159
1162
|
const handleK8sEvent = useCallback((event: K8sEvent) => {
|
|
@@ -1198,6 +1201,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1198
1201
|
|
|
1199
1202
|
const slow = slowInvalidationRef.current
|
|
1200
1203
|
if (!structural || applicationWorkload) slow.updatedKinds.add(kind)
|
|
1204
|
+
const gitops = gitopsTableChange(event.kind, event.group, event.operation)
|
|
1205
|
+
if (gitops.rows) slow.gitopsRowsChanged = true
|
|
1206
|
+
if (gitops.counts) slow.gitopsCountsChanged = true
|
|
1201
1207
|
|
|
1202
1208
|
// FAST tier — membership-sensitive + cheap, bounded 3s latency.
|
|
1203
1209
|
if (fast.timer === null) {
|
|
@@ -1248,7 +1254,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1248
1254
|
|
|
1249
1255
|
// SLOW tier — throttle expensive status churn. Workload membership changes
|
|
1250
1256
|
// also pass through here so the Applications refetch lands after its cache TTL.
|
|
1251
|
-
if ((!structural || applicationWorkload) && slow.timer === null) {
|
|
1257
|
+
if ((!structural || applicationWorkload || gitops.rows || gitops.counts) && slow.timer === null) {
|
|
1252
1258
|
slow.timer = window.setTimeout(() => {
|
|
1253
1259
|
const s = slowInvalidationRef.current
|
|
1254
1260
|
for (const k of s.updatedKinds) {
|
|
@@ -1257,8 +1263,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1257
1263
|
if ([...s.updatedKinds].some((k) => ['deployments', 'statefulsets', 'daemonsets', 'rollouts'].includes(k))) {
|
|
1258
1264
|
queryClient.invalidateQueries({ queryKey: ['applications'] })
|
|
1259
1265
|
}
|
|
1266
|
+
if (s.gitopsRowsChanged) queryClient.invalidateQueries({ queryKey: ['gitops-rows-main'] })
|
|
1267
|
+
if (s.gitopsCountsChanged) queryClient.invalidateQueries({ queryKey: ['gitops-resource-counts'] })
|
|
1260
1268
|
queryClient.invalidateQueries({ queryKey: ['dashboard'] }) // health reflects status updates
|
|
1261
|
-
slowInvalidationRef.current = { updatedKinds: new Set(), timer: null }
|
|
1269
|
+
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1262
1270
|
}, 15000)
|
|
1263
1271
|
}
|
|
1264
1272
|
}, [queryClient])
|
|
@@ -1272,7 +1280,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1272
1280
|
if (slowInvalidationRef.current.timer !== null) clearTimeout(slowInvalidationRef.current.timer)
|
|
1273
1281
|
if (timelineInvalidationRef.current.timer !== null) clearTimeout(timelineInvalidationRef.current.timer)
|
|
1274
1282
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1275
|
-
slowInvalidationRef.current = { updatedKinds: new Set(), timer: null }
|
|
1283
|
+
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1276
1284
|
timelineInvalidationRef.current = { timer: null }
|
|
1277
1285
|
}, [])
|
|
1278
1286
|
|
|
@@ -1294,7 +1302,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1294
1302
|
if (slowInvalidationRef.current.timer !== null) clearTimeout(slowInvalidationRef.current.timer)
|
|
1295
1303
|
if (timelineInvalidationRef.current.timer !== null) clearTimeout(timelineInvalidationRef.current.timer)
|
|
1296
1304
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1297
|
-
slowInvalidationRef.current = { updatedKinds: new Set(), timer: null }
|
|
1305
|
+
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1298
1306
|
timelineInvalidationRef.current = { timer: null }
|
|
1299
1307
|
|
|
1300
1308
|
// Close any open drawers/overlays — old cluster's resources don't exist on the new one
|
package/src/api/radarFeatures.ts
CHANGED
|
@@ -51,6 +51,9 @@ export const RADAR_FEATURES = {
|
|
|
51
51
|
cnpgProtectionSetup: { label: 'CloudNativePG backup setup', flag: 'cnpgProtectionSetup', flagShippedWithEndpoint: true },
|
|
52
52
|
veleroWorkspace: { label: 'Velero views', flag: 'veleroWorkspace', flagShippedWithEndpoint: true },
|
|
53
53
|
veleroBackupNow: { label: 'Back up now', flag: 'veleroBackupNow', flagShippedWithEndpoint: true },
|
|
54
|
+
veleroSchedulePause: { label: 'Pause and resume Velero schedules', flag: 'veleroSchedulePause', flagShippedWithEndpoint: true },
|
|
55
|
+
veleroRunVolumes: { label: 'Velero run volumes', flag: 'veleroRunVolumes', flagShippedWithEndpoint: true },
|
|
56
|
+
veleroRunArtifacts: { label: 'Velero run contents and log', flag: 'veleroRunArtifacts', flagShippedWithEndpoint: true },
|
|
54
57
|
veleroRuns: { label: 'Velero backup and restore lists', flag: 'veleroRuns', flagShippedWithEndpoint: true },
|
|
55
58
|
veleroDeleteBackup: { label: 'Delete a Velero backup', flag: 'veleroDeleteBackup', flagShippedWithEndpoint: true },
|
|
56
59
|
resourceDeletePreconditions: { label: 'Delete only the object you reviewed', flag: 'resourceDeletePreconditions', flagShippedWithEndpoint: true },
|
|
@@ -79,6 +82,7 @@ export const RADAR_FEATURES = {
|
|
|
79
82
|
agentSigninCheck: { label: 'Agent sign-in checks', flag: 'agentSigninCheck', flagShippedWithEndpoint: true },
|
|
80
83
|
podFileUpload: { label: 'Pod file uploads', flag: 'podFileUpload', flagShippedWithEndpoint: true },
|
|
81
84
|
vulnerabilities: { label: 'Vulnerability views', flag: 'vulnerabilities', flagShippedWithEndpoint: true },
|
|
85
|
+
runtimeAdvisoryChecks: { label: 'Java4Shell checks', flag: 'runtimeAdvisoryChecks', flagShippedWithEndpoint: true },
|
|
82
86
|
} as const satisfies Record<string, RadarFeatureSpec>
|
|
83
87
|
|
|
84
88
|
export type RadarFeature = keyof typeof RADAR_FEATURES
|
package/src/api/velero.ts
CHANGED
|
@@ -81,6 +81,35 @@ export function useVeleroBackupNow() {
|
|
|
81
81
|
})
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
// POST /api/velero/schedules/{namespace}/{name}/{pause|resume}
|
|
85
|
+
//
|
|
86
|
+
// Sets spec.paused, bound to the version of the schedule the user reviewed (a
|
|
87
|
+
// schedule edited since is refused, 409). skipImmediately is written to the
|
|
88
|
+
// schedule: true skips the run due on resume, null leaves it to the server.
|
|
89
|
+
export function useVeleroSchedulePause() {
|
|
90
|
+
const queryClient = useQueryClient()
|
|
91
|
+
const { guard } = useRadarFeature('veleroSchedulePause')
|
|
92
|
+
return useMutation({
|
|
93
|
+
mutationFn: ({ namespace, name, paused, resourceVersion, skipImmediately = null }: {
|
|
94
|
+
namespace: string
|
|
95
|
+
name: string
|
|
96
|
+
paused: boolean
|
|
97
|
+
resourceVersion: string
|
|
98
|
+
skipImmediately?: boolean | null
|
|
99
|
+
}) =>
|
|
100
|
+
guard(() =>
|
|
101
|
+
fetchJSON<{ paused: boolean; changed: boolean }>(
|
|
102
|
+
`/velero/schedules/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${paused ? 'pause' : 'resume'}`,
|
|
103
|
+
{ method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resourceVersion, skipImmediately }) },
|
|
104
|
+
),
|
|
105
|
+
),
|
|
106
|
+
onSuccess: () => {
|
|
107
|
+
void queryClient.invalidateQueries({ queryKey: ['velero'] })
|
|
108
|
+
void queryClient.invalidateQueries({ queryKey: ['resource'] })
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
84
113
|
/** internal/velero RunRow: one Backup or Restore as its list and pages show it. */
|
|
85
114
|
export interface VeleroRunRow {
|
|
86
115
|
namespace: string
|
|
@@ -199,3 +228,150 @@ export function useVeleroBackupDeletion(namespace: string, name: string, uid: st
|
|
|
199
228
|
},
|
|
200
229
|
})
|
|
201
230
|
}
|
|
231
|
+
export interface VeleroRunContentsResponse {
|
|
232
|
+
groups: { kind: string; count: number; matched: number; items: { namespace: string; name: string; action?: string }[] }[]
|
|
233
|
+
total: number
|
|
234
|
+
matched: number
|
|
235
|
+
namespaces: string[]
|
|
236
|
+
actions: Record<string, number>
|
|
237
|
+
truncated: boolean
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export type VeleroLogLevel = 'error' | 'warning' | 'info' | 'debug' | 'other'
|
|
241
|
+
export interface VeleroRunLogResponse {
|
|
242
|
+
lines: { number: number; level: VeleroLogLevel; text: string }[]
|
|
243
|
+
counts: Record<VeleroLogLevel, number>
|
|
244
|
+
matched: number
|
|
245
|
+
truncated: boolean
|
|
246
|
+
partial: boolean
|
|
247
|
+
decodedBytes: number
|
|
248
|
+
limit?: string
|
|
249
|
+
/** The levels the lines were selected from; with levels=auto, the server's choice. */
|
|
250
|
+
levels: VeleroLogLevel[]
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function useVeleroRunArtifact<T>(kind: 'backups' | 'restores', namespace: string, name: string, artifact: 'contents' | 'log' | 'volumes', params: URLSearchParams) {
|
|
254
|
+
const { guard, gatedKey } = useRadarFeature(artifact === 'volumes' ? 'veleroRunVolumes' : 'veleroRunArtifacts')
|
|
255
|
+
const base = getApiBase()
|
|
256
|
+
const search = params.toString()
|
|
257
|
+
return useQuery<T>({
|
|
258
|
+
queryKey: ['velero', artifact, base, kind, namespace, name, search, ...gatedKey],
|
|
259
|
+
queryFn: ({ signal }) => guard(() => fetchJSON<T>(`/velero/${kind}/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${artifact}?${search}`, { method: 'POST', signal })),
|
|
260
|
+
enabled: !!namespace && !!name,
|
|
261
|
+
// A tab or filter is the user's request; don't create DownloadRequests on focus or a timer.
|
|
262
|
+
staleTime: 0,
|
|
263
|
+
refetchOnWindowFocus: false,
|
|
264
|
+
refetchOnReconnect: false,
|
|
265
|
+
retry: false,
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function useVeleroRunContents(kind: 'backups' | 'restores', namespace: string, name: string, filters: { q: string; action: string; namespace: string }) {
|
|
270
|
+
return useVeleroRunArtifact<VeleroRunContentsResponse>(kind, namespace, name, 'contents', new URLSearchParams(filters))
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function useVeleroRunLog(kind: 'backups' | 'restores', namespace: string, name: string, levels: string, q: string) {
|
|
274
|
+
return useVeleroRunArtifact<VeleroRunLogResponse>(kind, namespace, name, 'log', new URLSearchParams({ levels, q }))
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface VeleroVolumeDetails {
|
|
278
|
+
snapshotHandle?: string
|
|
279
|
+
size?: number
|
|
280
|
+
incrementalSize?: number
|
|
281
|
+
driver?: string
|
|
282
|
+
vscName?: string
|
|
283
|
+
operationID?: string
|
|
284
|
+
readyToUse?: boolean
|
|
285
|
+
volumeGroupSnapshotHandle?: string
|
|
286
|
+
dataMover?: string
|
|
287
|
+
uploaderType?: string
|
|
288
|
+
retainedSnapshot?: string
|
|
289
|
+
volumeType?: string
|
|
290
|
+
volumeAZ?: string
|
|
291
|
+
iops?: string
|
|
292
|
+
volumeName?: string
|
|
293
|
+
podName?: string
|
|
294
|
+
podNamespace?: string
|
|
295
|
+
nodeName?: string
|
|
296
|
+
phase?: string
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface VeleroVolumeRecord {
|
|
300
|
+
pvcName?: string
|
|
301
|
+
pvcNamespace?: string
|
|
302
|
+
pvName?: string
|
|
303
|
+
method?: string
|
|
304
|
+
snapshotDataMoved: boolean
|
|
305
|
+
preserveLocalSnapshot?: boolean
|
|
306
|
+
result?: string
|
|
307
|
+
skipped?: boolean
|
|
308
|
+
skippedReason?: string
|
|
309
|
+
started?: string
|
|
310
|
+
completed?: string
|
|
311
|
+
csiSnapshotInfo?: VeleroVolumeDetails
|
|
312
|
+
snapshotDataMovementInfo?: VeleroVolumeDetails
|
|
313
|
+
nativeSnapshotInfo?: VeleroVolumeDetails
|
|
314
|
+
podVolumeInfo?: VeleroVolumeDetails
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export interface VeleroRunVolumesResponse {
|
|
318
|
+
volumes: VeleroVolumeRecord[]
|
|
319
|
+
total: number
|
|
320
|
+
truncated: boolean
|
|
321
|
+
/** The run had finished when Radar read it, just before fetching the file; otherwise Velero may still rewrite the record. */
|
|
322
|
+
finishedAtRead: boolean
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface VeleroVolumeOperation {
|
|
326
|
+
kind: string
|
|
327
|
+
name: string
|
|
328
|
+
pod?: string
|
|
329
|
+
podNamespace?: string
|
|
330
|
+
volume?: string
|
|
331
|
+
pvc?: string
|
|
332
|
+
pvcNamespace?: string
|
|
333
|
+
node?: string
|
|
334
|
+
phase?: string
|
|
335
|
+
bytesDone?: number
|
|
336
|
+
bytesTotal?: number
|
|
337
|
+
message?: string
|
|
338
|
+
started?: string
|
|
339
|
+
completed?: string
|
|
340
|
+
longRunning: boolean
|
|
341
|
+
nodeAgent?: 'running' | 'notRunning' | 'unknown'
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface VeleroVolumeOperationsResponse {
|
|
345
|
+
observedAt: string
|
|
346
|
+
runPhase: string
|
|
347
|
+
coverage: Record<string, import('@skyhook-io/k8s-ui').VeleroKindCoverage>
|
|
348
|
+
operations: VeleroVolumeOperation[]
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export function useVeleroRunVolumes(kind: 'backups' | 'restores', namespace: string, name: string) {
|
|
352
|
+
return useVeleroRunArtifact<VeleroRunVolumesResponse>(kind, namespace, name, 'volumes', new URLSearchParams())
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export function isVeleroRunFinished(phase: string | undefined): boolean {
|
|
356
|
+
return phase !== undefined && ['Completed', 'Failed', 'PartiallyFailed', 'FailedValidation', 'Deleting'].includes(phase)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export function useVeleroVolumeOperations(kind: 'backups' | 'restores', namespace: string, name: string) {
|
|
360
|
+
const { guard, gatedKey } = useRadarFeature('veleroRunVolumes')
|
|
361
|
+
const base = getApiBase()
|
|
362
|
+
return useQuery<VeleroVolumeOperationsResponse>({
|
|
363
|
+
queryKey: ['velero', 'volume-operations', base, kind, namespace, name, ...gatedKey],
|
|
364
|
+
queryFn: ({ signal }) => guard(() => fetchJSON<VeleroVolumeOperationsResponse>(`/velero/${kind}/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/volume-operations`, signal)),
|
|
365
|
+
enabled: !!namespace && !!name,
|
|
366
|
+
staleTime: 10_000,
|
|
367
|
+
refetchInterval: (query) => {
|
|
368
|
+
const data = query.state.data
|
|
369
|
+
if (!data) return false
|
|
370
|
+
// Velero leaves finished operation objects in place, so only an
|
|
371
|
+
// unfinished one, a run still going or a kind still loading needs polling.
|
|
372
|
+
const settled = (phase?: string) => phase === 'Completed' || phase === 'Failed' || phase === 'Canceled'
|
|
373
|
+
return data.operations.some((row) => !settled(row.phase)) || Object.values(data.coverage).some((coverage) => coverage.state === 'syncing') || !isVeleroRunFinished(data.runPhase) ? 10_000 : false
|
|
374
|
+
},
|
|
375
|
+
retry: shouldRetryRadarQuery,
|
|
376
|
+
})
|
|
377
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import type { ReadGap } from '@skyhook-io/k8s-ui/types/read-coverage'
|
|
3
|
+
import type { ResourceReadCoverage } from '@skyhook-io/k8s-ui/types/resource-coverage'
|
|
3
4
|
import type { APIResource } from '../types'
|
|
4
5
|
import { ApiError, fetchJSON, useRadarFeature } from './client'
|
|
5
6
|
import { readActionFor } from '@skyhook-io/k8s-ui/utils/read-actions'
|
|
7
|
+
import { getApiBase } from './config'
|
|
6
8
|
import { shouldRetryRadarQuery } from './radarFeatures'
|
|
7
9
|
|
|
8
10
|
// Mirrors internal/vulnerabilities/types.go.
|
|
@@ -172,6 +174,62 @@ export interface VulnerabilitiesParams {
|
|
|
172
174
|
workload?: { kind: string; group?: string; namespace: string; name: string }
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
export interface Java4ShellFinding {
|
|
178
|
+
workload: VulnerabilityWorkloadRef
|
|
179
|
+
container: string
|
|
180
|
+
image: string
|
|
181
|
+
digest: string
|
|
182
|
+
version: string
|
|
183
|
+
fixedIn?: string
|
|
184
|
+
pods: number
|
|
185
|
+
vbmiPods: number
|
|
186
|
+
unknownCPUPods: number
|
|
187
|
+
mitigationDeclaredPods: number
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const JAVA4SHELL_CVE = 'CVE-2026-114938'
|
|
191
|
+
|
|
192
|
+
export interface Java4ShellUnassessed {
|
|
193
|
+
workload: VulnerabilityWorkloadRef
|
|
194
|
+
container: string
|
|
195
|
+
image: string
|
|
196
|
+
digest?: string
|
|
197
|
+
reason: string
|
|
198
|
+
pods: number
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface Java4ShellResult {
|
|
202
|
+
findings: Java4ShellFinding[]
|
|
203
|
+
containers: number
|
|
204
|
+
matches: number
|
|
205
|
+
findingGroups: number
|
|
206
|
+
unassessed: Record<string, number>
|
|
207
|
+
unassessedRows: Java4ShellUnassessed[]
|
|
208
|
+
unassessedGroups: number
|
|
209
|
+
coverage: ResourceReadCoverage
|
|
210
|
+
workload?: VulnerabilityWorkloadRef
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function useJava4ShellCheck(namespaces: string[], context: string, workload?: VulnerabilityWorkloadRef) {
|
|
214
|
+
const { guard } = useRadarFeature('runtimeAdvisoryChecks')
|
|
215
|
+
const query = new URLSearchParams()
|
|
216
|
+
if (workload) {
|
|
217
|
+
query.set('workloadKind', workload.kind)
|
|
218
|
+
query.set('workloadGroup', workload.group)
|
|
219
|
+
query.set('workloadNamespace', workload.namespace)
|
|
220
|
+
query.set('workloadName', workload.name)
|
|
221
|
+
} else if (namespaces.length > 0) {
|
|
222
|
+
query.set('namespaces', [...namespaces].sort().join(','))
|
|
223
|
+
}
|
|
224
|
+
const path = '/vulnerabilities/java4shell' + (query.size ? `?${query}` : '')
|
|
225
|
+
return useQuery({
|
|
226
|
+
queryKey: ['java4shell', getApiBase(), context, path],
|
|
227
|
+
queryFn: ({ signal }) => guard(() => fetchJSON<Java4ShellResult>(path, { signal, cache: 'no-store' })),
|
|
228
|
+
enabled: false,
|
|
229
|
+
retry: false,
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
175
233
|
// What an answer is about, apart from its filters: the workload and the
|
|
176
234
|
// namespaces. An answer about another one is never shown as a placeholder.
|
|
177
235
|
function subjectOfPath(path: unknown): string {
|
|
@@ -10,9 +10,10 @@ const vulnerabilityReports: APIResource = {
|
|
|
10
10
|
namespaced: true, verbs: ['list', 'get'], isCrd: true,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function render(path: string, resources: APIResource[] = []) {
|
|
13
|
+
function render(path: string, resources: APIResource[] = [], runtimeAdvisoryChecks = false) {
|
|
14
14
|
const client = new QueryClient({ defaultOptions: { queries: { retry: false, enabled: false } } })
|
|
15
15
|
client.setQueryData(['api-resources'], resources)
|
|
16
|
+
client.setQueryData(['capabilities'], { features: { runtimeAdvisoryChecks } })
|
|
16
17
|
return renderToStaticMarkup(
|
|
17
18
|
<QueryClientProvider client={client}>
|
|
18
19
|
<MemoryRouter initialEntries={[path]}>
|
|
@@ -33,12 +34,13 @@ describe('ChecksViewTabs', () => {
|
|
|
33
34
|
expect(html).not.toContain('role="tab"')
|
|
34
35
|
})
|
|
35
36
|
|
|
36
|
-
it('shows Vulnerabilities
|
|
37
|
+
it('shows Vulnerabilities for scanner reports or the on-demand check', () => {
|
|
37
38
|
expect(render('/checks')).not.toContain('Vulnerabilities')
|
|
38
39
|
|
|
39
40
|
const html = render('/checks?namespaces=shop', [vulnerabilityReports])
|
|
40
41
|
expect(html).toContain('href="/checks/vulnerabilities?namespaces=shop"')
|
|
41
42
|
expect(html).toContain('Vulnerabilities')
|
|
43
|
+
expect(render('/checks?namespaces=shop', [], true)).toContain('href="/checks/vulnerabilities?namespaces=shop"')
|
|
42
44
|
})
|
|
43
45
|
|
|
44
46
|
it('marks Vulnerabilities as the current tab on its route', () => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { clsx } from 'clsx'
|
|
2
2
|
import { Link, useLocation, type To } from 'react-router-dom'
|
|
3
3
|
import { useAPIResources } from '../../api/apiResources'
|
|
4
|
+
import { useCapabilities } from '../../api/client'
|
|
4
5
|
import { hasVulnerabilityReports } from '../../api/vulnerabilities'
|
|
5
6
|
|
|
6
7
|
export function ChecksViewTabs() {
|
|
7
8
|
const { pathname, search } = useLocation()
|
|
8
9
|
const { data: resources } = useAPIResources()
|
|
10
|
+
const { data: capabilities } = useCapabilities()
|
|
9
11
|
const upgrade = pathname.startsWith('/checks/upgrade')
|
|
10
12
|
const vulnerabilities = pathname.startsWith('/checks/vulnerabilities')
|
|
11
13
|
const current = new URLSearchParams(search)
|
|
@@ -26,8 +28,7 @@ export function ChecksViewTabs() {
|
|
|
26
28
|
<ChecksTab to={{ pathname: '/checks/upgrade', search: upgradeSearch.toString() }} active={upgrade}>
|
|
27
29
|
Upgrade impact
|
|
28
30
|
</ChecksTab>
|
|
29
|
-
{
|
|
30
|
-
{(vulnerabilities || hasVulnerabilityReports(resources)) && (
|
|
31
|
+
{(vulnerabilities || capabilities?.features?.runtimeAdvisoryChecks || hasVulnerabilityReports(resources)) && (
|
|
31
32
|
<ChecksTab to={{ pathname: '/checks/vulnerabilities', search: browsing.toString() }} active={vulnerabilities}>
|
|
32
33
|
Vulnerabilities
|
|
33
34
|
</ChecksTab>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
+
import { expect, it } from 'vitest'
|
|
4
|
+
import { getApiBase } from '../../api/config'
|
|
5
|
+
import type { Java4ShellResult } from '../../api/vulnerabilities'
|
|
6
|
+
import { Java4ShellPanel } from './Java4ShellPanel'
|
|
7
|
+
|
|
8
|
+
it('shows the Java home count before opening details and counts other failures once', () => {
|
|
9
|
+
const result: Java4ShellResult = {
|
|
10
|
+
findings: [],
|
|
11
|
+
containers: 6,
|
|
12
|
+
matches: 0,
|
|
13
|
+
findingGroups: 0,
|
|
14
|
+
unassessed: { java_home_declared: 3, auth_required: 2, no_java_declaration: 1 },
|
|
15
|
+
unassessedRows: [],
|
|
16
|
+
unassessedGroups: 3,
|
|
17
|
+
coverage: { status: 'complete', scope: { type: 'all_namespaces' }, read: { type: 'all_namespaces' }, gaps: [] },
|
|
18
|
+
}
|
|
19
|
+
const client = new QueryClient({ defaultOptions: { queries: { enabled: false } } })
|
|
20
|
+
client.setQueryData(['java4shell', getApiBase(), 'fixture', '/vulnerabilities/java4shell'], result)
|
|
21
|
+
const html = renderToStaticMarkup(
|
|
22
|
+
<QueryClientProvider client={client}>
|
|
23
|
+
<Java4ShellPanel context="fixture" connected onNavigateToResource={() => {}} />
|
|
24
|
+
</QueryClientProvider>,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
expect(html).toContain('Images for 3 containers set <code>JAVA_HOME</code>. Verify the installed Java version.')
|
|
28
|
+
expect(html).toContain('Java version unassessed in 2 containers.')
|
|
29
|
+
expect(html).toContain('aria-expanded="false"')
|
|
30
|
+
expect(html).not.toContain('aria-label="Unassessed containers by workload"')
|
|
31
|
+
})
|