feat: Added vuln filter
This commit is contained in:
+4
-1
@@ -996,11 +996,14 @@ export interface VulnAlertRuleInput {
|
||||
}
|
||||
|
||||
export const vulnerabilities = {
|
||||
list(params?: { severity?: string; state?: string; server?: string; tags?: Record<string, string> }): Promise<VulnGroup[]> {
|
||||
list(params?: { severity?: string; state?: string; server?: string; hasFix?: boolean; tags?: Record<string, string> }): Promise<VulnGroup[]> {
|
||||
const q = new URLSearchParams();
|
||||
if (params?.severity) q.set("severity", params.severity);
|
||||
if (params?.state) q.set("state", params.state);
|
||||
if (params?.server) q.set("server", params.server);
|
||||
// Explicitly undefined-checked: `false` is a real selection here (the
|
||||
// unfixable set), so a truthiness test would silently drop it.
|
||||
if (params?.hasFix !== undefined) q.set("has_fix", String(params.hasFix));
|
||||
for (const [k, v] of Object.entries(params?.tags ?? {})) q.append("tag", `${k}:${v}`);
|
||||
const qs = q.toString();
|
||||
return request<VulnGroup[]>(`/vulnerabilities${qs ? `?${qs}` : ""}`);
|
||||
|
||||
Reference in New Issue
Block a user