mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 15:53:46 -04:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Aditya Tripathi <aditya@climactic.co>
21 lines
741 B
JavaScript
21 lines
741 B
JavaScript
// 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,
|
|
};
|
|
}
|