main
ts 92 lines 2.39 KB
Raw
1 import type {
2 AvailableCyclesResponse,
3 PatchTuesdayPriorityQuery,
4 PatchTuesdayQuery,
5 PatchTuesdayResponse,
6 PatchTuesdaySearchQuery,
7 PatchTuesdaySummaryQuery,
8 PatchTuesdaySummaryResponse
9 } from "@/types/patchTuesday.d"
10 import { HttpClient } from "../httpClient"
11
12 const BASE_PATH = "/patch-tuesday"
13
14 // TODO-FE: refactor
15 export default {
16 /**
17 * Get full Patch Tuesday data for a specific cycle
18 * Includes all CVE x product records with EPSS and KEV enrichment
19 */
20 getPatchTuesday(query?: PatchTuesdayQuery, signal?: AbortSignal) {
21 return HttpClient.get<PatchTuesdayResponse>(BASE_PATH, {
22 params: {
23 cycle: query?.cycle,
24 include_epss: query?.include_epss !== false,
25 include_kev: query?.include_kev !== false
26 },
27 signal
28 })
29 },
30
31 /**
32 * Get Patch Tuesday summary with top prioritized items
33 * Lighter endpoint suitable for dashboards
34 */
35 getSummary(query?: PatchTuesdaySummaryQuery, signal?: AbortSignal) {
36 return HttpClient.get<PatchTuesdaySummaryResponse>(`${BASE_PATH}/summary`, {
37 params: {
38 cycle: query?.cycle,
39 include_epss: query?.include_epss !== false,
40 include_kev: query?.include_kev !== false,
41 top_n: query?.top_n || 25
42 },
43 signal
44 })
45 },
46
47 /**
48 * Get available Patch Tuesday cycles
49 * Returns list of recent cycles and next Patch Tuesday date
50 */
51 getCycles(signal?: AbortSignal) {
52 return HttpClient.get<AvailableCyclesResponse>(`${BASE_PATH}/cycles`, { signal })
53 },
54
55 /**
56 * Search for specific CVEs in Patch Tuesday data
57 */
58 searchCVEs(query: PatchTuesdaySearchQuery, signal?: AbortSignal) {
59 return HttpClient.get<PatchTuesdayResponse>(`${BASE_PATH}/search`, {
60 params: {
61 cve_ids: query.cve_ids,
62 cycle: query.cycle
63 },
64 signal
65 })
66 },
67
68 /**
69 * Get vulnerabilities filtered by priority level (P0, P1, P2, P3)
70 */
71 getByPriority(query: PatchTuesdayPriorityQuery, signal?: AbortSignal) {
72 return HttpClient.get<PatchTuesdayResponse>(`${BASE_PATH}/priority/${query.priority_level}`, {
73 params: {
74 cycle: query.cycle,
75 include_epss: query.include_epss !== false,
76 include_kev: query.include_kev !== false
77 },
78 signal
79 })
80 },
81
82 /**
83 * Get only CISA KEV (Known Exploited Vulnerabilities) items
84 * These are actively exploited and should be prioritized immediately
85 */
86 getKEVItems(cycle?: string, signal?: AbortSignal) {
87 return HttpClient.get<PatchTuesdayResponse>(`${BASE_PATH}/kev`, {
88 params: { cycle },
89 signal
90 })
91 }
92 }