Nasaq
Components

VulnReport

A vulnerability scan report - CVE counts per severity, the worst findings with the version that fixes them, the trend against the previous scan and a stacked history of the last scans.

PreviewOpen ↗

Code

import { VulnReport, type VulnFinding, type VulnScan } from "@fadymondy/nasaq/web";declare const findings: VulnFinding[];declare const history: VulnScan[];declare const api: { scan(): Promise<void> };export const Vulns = () => <VulnReport findings={findings} history={history} lastScanAt={Date.now()} onScan={() => api.scan()} />;

Security · beta

Live examples and controls: VulnReport in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/vuln-report.json

Show what the last security scan found. Four tiles count findings by severity (critical, high, medium, low), a badge says whether the total went up or down since the previous scan, the top findings are listed (most severe first, then highest CVSS) with the installed and the fixed version and a copy button for the CVE id, and the scan history is drawn as stacked bars. With no findings it says so plainly; with no scan yet it shows an empty state. It has no scanner: you pass findings (or counts) and history, and onScan starts a new scan.

When to use

  • A security page in an admin or hosting product.
  • SeverityTiles on a dashboard.

When not to use

  • Triage workflows with assignees and status per CVE: build on DataTable.
  • Certificate expiry: use CertificateMonitor.

Import

import { VulnReport } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

import { VulnReport, type VulnFinding, type VulnScan } from "@fadymondy/nasaq/web";

declare const findings: VulnFinding[];
declare const history: VulnScan[];
declare const api: { scan(): Promise<void> };

export const Vulns = () => <VulnReport findings={findings} history={history} lastScanAt={Date.now()} onScan={() => api.scan()} />;

Anatomy

VulnReport                   data-slot="vuln-report"
├─ header                    title, last scan, Scan now
├─ total + trend Badge       "3 fewer than the previous scan"
├─ SeverityTiles             Critical, High, Medium, Low
├─ top findings              severity Badge, CVE id, title, package@version → fixed version, CVSS, copy
└─ scan history              stacked bar per scan, oldest first

API

VulnReport: every Card prop except children, plus:

PropTypeDefaultDescription
findingsreadonly VulnFinding[]required{ id, severity, cvss?, title?, package, installedVersion?, fixedVersion? }.
countsPartial<SeverityCounts>from findingsOverride, for example when findings holds only the top items.
historyreadonly VulnScan[][]{ id, at, counts }, oldest first.
lastScanAtDate | number | stringShown in the description.
topLimitnumber5How many findings to list.
scanningbooleanfalseLoading state of Scan now.
onScan() => Promise<void | { error? }>Shows Scan now.
onOpenFinding(finding) => voidMakes the CVE id a button.
labelsPartial<VulnReportLabels>Override any string.

SeverityTiles: counts. Helpers (pure, tested): countBySeverity, totalCount, riskTone, topFindings, trend, isCveId.

Examples

Counts only

import { SeverityTiles } from "@fadymondy/nasaq/web";

export const Tiles = () => <SeverityTiles counts={{ critical: 1, high: 4, medium: 9, low: 12 }} />;

Accessibility

  • Severity is always a word. The counts are a description list (dl). Each history bar is an image with a text alternative giving the date and total.
  • Copy buttons have a name that includes the CVE id.

RTL & i18n

  • English and Arabic strings follow the Nasaq locale. CVE ids, package names and versions stay left to right. The history runs in reading order.

Styling & tokens

  • Built on Card, Badge, CopyButton, EmptyState and --nq-* tokens. Target [data-slot="vuln-report"].

Do / Don't

  • Do show the fixed version: it is the action to take.
  • Do say "no fix yet" when there is none.
  • Don't show a green all-clear for a scan that failed: leave lastScanAt out and show an error.
  • Don't invent CVE ids in production data.

Lab

https://docs.nasaqui.com/?path=/docs/components-security-vulnerability-report--docs

On this page