// The command palette entry for a vulnerability ID: "CVE-2021-44228" or "GHSA-jfh8-c2jp-5v3q" opens the // Security page with that search. `url` is null when the instance does not allow image scanning. const VULNERABILITY_ID = /^(cve|ghsa)-[a-z0-9-]+$/i; export function vulnerabilitySearchItem(query, url) { const trimmed = String(query ?? '').trim(); if (!url || !VULNERABILITY_ID.test(trimmed)) { return null; } const id = trimmed.replace(/^[a-z]+/i, (prefix) => prefix.toUpperCase()); return { name: `Find ${id} in your images`, type: 'navigation', description: 'Search the Security page', link: `${url}?search=${encodeURIComponent(id)}`, search_text: id, }; }