main
ts 333 lines 7.47 KB
Raw
1 export enum AuditStatus {
2 PASS = "pass",
3 FAIL = "fail",
4 WARNING = "warning",
5 NOT_APPLICABLE = "not_applicable"
6 }
7
8 export enum SeverityLevel {
9 CRITICAL = "critical",
10 HIGH = "high",
11 MEDIUM = "medium",
12 LOW = "low",
13 INFO = "info"
14 }
15
16 // ==================== Request Types ====================
17
18 export interface GitHubAuditRequest {
19 organization: string
20 include_repos?: boolean
21 include_workflows?: boolean
22 include_members?: boolean
23 repo_filter?: string[]
24 }
25
26 export interface GitHubAuditConfigCreate {
27 customer_code: string
28 github_token: string
29 organization: string
30 token_type?: string
31 token_expires_at?: string | null
32 enabled?: boolean
33 auto_audit_enabled?: boolean
34 audit_schedule_cron?: string | null
35 include_repos?: boolean
36 include_workflows?: boolean
37 include_members?: boolean
38 include_archived_repos?: boolean
39 repo_filter_mode?: string
40 repo_filter_list?: string[]
41 notify_on_critical?: boolean
42 notify_on_high?: boolean
43 notification_webhook_url?: string | null
44 notification_email?: string | null
45 minimum_passing_score?: number
46 created_by?: string | null
47 }
48
49 export interface GitHubAuditConfigUpdate {
50 github_token?: string | null
51 organization?: string | null
52 token_type?: string | null
53 token_expires_at?: string | null
54 enabled?: boolean | null
55 auto_audit_enabled?: boolean | null
56 audit_schedule_cron?: string | null
57 include_repos?: boolean | null
58 include_workflows?: boolean | null
59 include_members?: boolean | null
60 include_archived_repos?: boolean | null
61 repo_filter_mode?: string | null
62 repo_filter_list?: string[] | null
63 notify_on_critical?: boolean | null
64 notify_on_high?: boolean | null
65 notification_webhook_url?: string | null
66 notification_email?: string | null
67 minimum_passing_score?: number | null
68 updated_by?: string | null
69 }
70
71 export interface GitHubAuditExclusionCreate {
72 check_id: string
73 resource_name?: string | null
74 resource_type?: string | null
75 reason: string
76 approved_by?: string | null
77 expires_at?: string | null
78 created_by: string
79 }
80
81 export interface GitHubAuditExclusionUpdate {
82 reason?: string | null
83 approved_by?: string | null
84 expires_at?: string | null
85 enabled?: boolean | null
86 }
87
88 export interface GitHubAuditBaselineCreate {
89 name: string
90 description?: string | null
91 expected_checks?: Record<string, string> | null
92 baseline_report_id?: number | null
93 is_active?: boolean
94 created_by: string
95 }
96
97 export interface GitHubAuditBaselineUpdate {
98 name?: string | null
99 description?: string | null
100 is_active?: boolean | null
101 }
102
103 // ==================== Model Types ====================
104
105 export interface GitHubAuditConfig {
106 id: number
107 customer_code: string
108 github_token: string
109 organization: string
110 token_type: string
111 token_expires_at: string | null
112 enabled: boolean
113 auto_audit_enabled: boolean
114 audit_schedule_cron: string | null
115 include_repos: boolean
116 include_workflows: boolean
117 include_members: boolean
118 include_archived_repos: boolean
119 repo_filter_mode: string
120 repo_filter_list: string[] | null
121 notify_on_critical: boolean
122 notify_on_high: boolean
123 notification_webhook_url: string | null
124 notification_email: string | null
125 minimum_passing_score: number
126 created_at: string
127 updated_at: string
128 created_by: string | null
129 updated_by: string | null
130 last_audit_at: string | null
131 last_audit_score: number | null
132 last_audit_grade: string | null
133 }
134
135 export interface GitHubAuditReportSummary {
136 id: number
137 config_id: number
138 customer_code: string
139 report_name: string
140 organization: string
141 audit_started_at: string
142 audit_completed_at: string | null
143 audit_duration_seconds: number | null
144 total_repos_audited: number
145 total_checks: number
146 passed_checks: number
147 failed_checks: number
148 warning_checks: number
149 critical_findings: number
150 high_findings: number
151 medium_findings: number
152 low_findings: number
153 score: number
154 grade: string
155 status: string
156 triggered_by: string
157 triggered_by_user: string | null
158 }
159
160 export interface GitHubAuditReport extends GitHubAuditReportSummary {
161 full_report: GitHubAuditResponse | null
162 top_findings: AuditCheck[] | null
163 error_message: string | null
164 }
165
166 export interface GitHubAuditCheckExclusion {
167 id: number
168 config_id: number
169 customer_code: string
170 check_id: string
171 resource_name: string | null
172 resource_type: string | null
173 reason: string
174 approved_by: string | null
175 approved_at: string | null
176 expires_at: string | null
177 enabled: boolean
178 created_at: string
179 created_by: string
180 }
181
182 export interface GitHubAuditBaseline {
183 id: number
184 config_id: number
185 customer_code: string
186 name: string
187 description: string | null
188 expected_checks: Record<string, string> | null
189 baseline_report_id: number | null
190 is_active: boolean
191 created_at: string
192 created_by: string
193 }
194
195 export interface AvailableCheck {
196 id: string
197 name: string
198 category: string
199 severity: string
200 description: string
201 }
202
203 // ==================== Audit Result Types ====================
204
205 export interface AuditCheck {
206 check_id: string
207 check_name: string
208 category: string
209 status: AuditStatus
210 severity: SeverityLevel
211 description: string
212 recommendation?: string | null
213 details?: Record<string, unknown> | null
214 resource_name?: string | null
215 resource_type?: string | null
216 }
217
218 export interface RepositoryAuditResult {
219 repo_name: string
220 repo_full_name: string
221 repo_url: string
222 is_private: boolean
223 is_archived: boolean
224 default_branch: string
225 checks: AuditCheck[]
226 passed_count: number
227 failed_count: number
228 warning_count: number
229 }
230
231 export interface OrganizationAuditResult {
232 org_name: string
233 org_url: string
234 checks: AuditCheck[]
235 passed_count: number
236 failed_count: number
237 warning_count: number
238 }
239
240 export interface WorkflowAuditResult {
241 repo_name: string
242 workflow_name: string
243 workflow_path: string
244 checks: AuditCheck[]
245 }
246
247 export interface MemberAuditResult {
248 username: string
249 role: string
250 has_2fa?: boolean | null
251 checks: AuditCheck[]
252 }
253
254 export interface AuditSummary {
255 organization: string
256 audit_timestamp: string
257 total_repos_audited: number
258 total_checks: number
259 passed_checks: number
260 failed_checks: number
261 warning_checks: number
262 critical_findings: number
263 high_findings: number
264 medium_findings: number
265 low_findings: number
266 score: number
267 grade: string
268 }
269
270 // ==================== Response Types ====================
271
272 export interface GitHubAuditResponse {
273 success: boolean
274 message: string
275 summary: AuditSummary | null
276 organization_results: OrganizationAuditResult | null
277 repository_results: RepositoryAuditResult[]
278 workflow_results: WorkflowAuditResult[]
279 member_results: MemberAuditResult[]
280 top_findings: AuditCheck[]
281 }
282
283 export interface GitHubAuditSummaryResponse {
284 success: boolean
285 message: string
286 summary: AuditSummary | null
287 top_findings: AuditCheck[]
288 }
289
290 export interface GitHubAuditConfigResponse {
291 success: boolean
292 message: string
293 config?: GitHubAuditConfig | null
294 configs?: GitHubAuditConfig[] | null
295 }
296
297 export interface GitHubAuditReportListResponse {
298 success: boolean
299 message: string
300 reports: GitHubAuditReportSummary[]
301 total_count: number
302 }
303
304 export interface GitHubAuditReportResponse {
305 success: boolean
306 message: string
307 report: GitHubAuditReport | null
308 }
309
310 export interface GitHubAuditExclusionResponse {
311 success: boolean
312 message: string
313 exclusion?: GitHubAuditCheckExclusion | null
314 exclusions?: GitHubAuditCheckExclusion[] | null
315 }
316
317 export interface GitHubAuditBaselineResponse {
318 success: boolean
319 message: string
320 baseline?: GitHubAuditBaseline | null
321 baselines?: GitHubAuditBaseline[] | null
322 }
323
324 export interface AvailableChecksResponse {
325 success: boolean
326 message: string
327 checks: AvailableCheck[]
328 }
329
330 export interface DeleteResponse {
331 success: boolean
332 message: string
333 }