Files
coolify/resources/js/vulnerability-search.js
T
033f0c84da v4.7 (#12478)
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>
2026-11-06 14:25:02 +01:00

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,
};
}