feat(ui): show advisory aliases and offer a bypass for each id

The vulnerability table lists the other ids of a finding. The expanded
row links to the bypass form for the id and for each alias.
This commit is contained in:
2026-11-24 01:39:54 +00:00
parent 43e075baf3
commit 8b4d4746df
4 changed files with 69 additions and 2 deletions
@@ -91,7 +91,7 @@
:label="bypassForm.type === 'cve' ? 'CVE ID' : 'Package'" :label="bypassForm.type === 'cve' ? 'CVE ID' : 'Package'"
:hint=" :hint="
bypassForm.type === 'cve' bypassForm.type === 'cve'
? 'Enter the CVE ID, for example CVE-2021-23337.' ? 'Enter a CVE or GHSA id, for example CVE-2021-23337. It also covers findings that carry it as an alias.'
: 'Enter a package, for example npm/[email protected], or npm/lodash for all versions. PyPI packages use the release version, for example pypi/[email protected].' : 'Enter a package, for example npm/[email protected], or npm/lodash for all versions. PyPI packages use the release version, for example pypi/[email protected].'
" "
required required
@@ -0,0 +1,50 @@
import { afterEach, describe, expect, it } from 'vitest'
import VulnerabilityTable from './VulnerabilityTable.vue'
import { mountStrict } from '@/test/mountStrict'
import { createTestRouter } from '@/test/router'
import type { VulnerabilityEntry } from '@/lib/report'
let restore: (() => void) | undefined
afterEach(() => {
restore?.()
restore = undefined
})
const entry = (over: Partial<VulnerabilityEntry>): VulnerabilityEntry => ({
id: 'GHSA-xvch-5gv4-984h',
severity: 'critical',
title: 'Prototype pollution',
description: '',
references: [],
fixed_in: '1.2.6',
bypassed: false,
...over,
})
async function open(vulnerabilities: VulnerabilityEntry[]) {
const router = await createTestRouter('/')
const mounted = await mountStrict(VulnerabilityTable, { props: { vulnerabilities }, global: { plugins: [router] } })
restore = mounted.restore
return mounted.wrapper
}
describe('VulnerabilityTable aliases', () => {
it('names the other ids of a finding next to its advisory id', async () => {
const w = await open([entry({ aliases: ['CVE-2021-44906'] })])
expect(w.text()).toContain('GHSA-xvch-5gv4-984h')
expect(w.text()).toContain('Also CVE-2021-44906')
})
it('shows no alias line for an older finding without aliases', async () => {
const w = await open([entry({})])
expect(w.text()).not.toContain('Also ')
})
it('offers a bypass link for the id and for each alias', async () => {
const w = await open([entry({ aliases: ['CVE-2021-44906'] })])
await w.find('tbody tr').trigger('click')
const hrefs = w.findAll('a').map((a) => a.attributes('href') ?? '')
expect(hrefs).toContain('/admin/bypasses?type=cve&target=GHSA-xvch-5gv4-984h')
expect(hrefs).toContain('/admin/bypasses?type=cve&target=CVE-2021-44906')
})
})
@@ -19,7 +19,12 @@
<StatusBadge v-if="vuln.bypassed" status="bypassed" label="Bypassed" :tones="{ bypassed: 'info' }" /> <StatusBadge v-if="vuln.bypassed" status="bypassed" label="Bypassed" :tones="{ bypassed: 'info' }" />
</span> </span>
</TableCell> </TableCell>
<TableCell label="Advisory" class="font-mono font-medium">{{ vuln.id }}</TableCell> <TableCell label="Advisory" class="font-mono font-medium">
<span class="block">{{ vuln.id }}</span>
<span v-if="vuln.aliases?.length" class="block text-xs font-normal text-muted-foreground">
Also {{ vuln.aliases.join(', ') }}
</span>
</TableCell>
<TableCell label="Summary"> <TableCell label="Summary">
<p class="m-0 line-clamp-2 break-words">{{ vuln.title || vuln.description }}</p> <p class="m-0 line-clamp-2 break-words">{{ vuln.title || vuln.description }}</p>
</TableCell> </TableCell>
@@ -59,6 +64,16 @@
Upgrade to <strong>{{ withVersionPrefix(vuln.fixed_in) }}</strong> or later. Upgrade to <strong>{{ withVersionPrefix(vuln.fixed_in) }}</strong> or later.
</Callout> </Callout>
<section>
<h3 class="mb-2 text-sm font-semibold">Bypass this advisory</h3>
<p class="m-0 mb-1 text-sm text-muted-foreground">A bypass for any of these ids covers this finding.</p>
<ul class="m-0 flex list-none flex-wrap gap-3 p-0 text-sm">
<li v-for="id in [vuln.id, ...(vuln.aliases ?? [])]" :key="id">
<Link :as="RouterLink" :to="{ path: '/admin/bypasses', query: { type: 'cve', target: id } }">{{ id }}</Link>
</li>
</ul>
</section>
<section v-if="vuln.references && vuln.references.length > 0"> <section v-if="vuln.references && vuln.references.length > 0">
<h3 class="mb-2 text-sm font-semibold">References ({{ vuln.references.length }})</h3> <h3 class="mb-2 text-sm font-semibold">References ({{ vuln.references.length }})</h3>
<ul class="m-0 flex list-none flex-col gap-1 p-0 text-sm"> <ul class="m-0 flex list-none flex-col gap-1 p-0 text-sm">
@@ -77,6 +92,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { RouterLink } from 'vue-router'
import { import {
Badge, Badge,
Callout, Callout,
+1
View File
@@ -9,6 +9,7 @@ export interface VulnerabilityEntry {
references: string[] references: string[]
fixed_in: string fixed_in: string
detected_by?: string[] detected_by?: string[]
aliases?: string[]
bypassed: boolean bypassed: boolean
bypass?: { id: string; reason: string; created_by: string; expires_at: string } bypass?: { id: string; reason: string; created_by: string; expires_at: string }
} }