-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoxWrapper.vb
1368 lines (1176 loc) · 41.1 KB
/
oxWrapper.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports System
Imports System.IO
Imports System.Text
Public Class policyWrapper
Public policyTypes As List(Of String)
Public Sub New()
policyTypes = New List(Of String)
With policyTypes
.Add("Git Posture")
.Add("Code Security")
.Add("Secret Scan")
.Add("Open Source Security")
.Add("SBOM")
.Add("Infrastructure as Code Scan")
.Add("CICD Posture")
.Add("Security Tool Coverage")
.Add("Container Security")
.Add("Artifact Integrity")
.Add("Cloud Security")
End With
End Sub
Public Function loadPolicy(policyName$) As List(Of oxPolicy)
loadPolicy = New List(Of oxPolicy)
Dim fileN$ = policyName + ".json"
If System.IO.File.Exists(fileN) = False Then
Console.WriteLine("Policy file '" + CurDir() + fileN + "' does not exist")
Exit Function
End If
Dim jsoN$ = streamReaderTxt(fileN)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getPoliciesByCategoryIdAndProfileId").SelectToken("policies").ToString
loadPolicy = JsonConvert.DeserializeObject(Of List(Of oxPolicy))(jsoN)
For Each P In loadPolicy
P.categorY = policyName
Next
Console.WriteLine(jsoN)
Return loadPolicy
End Function
End Class
Public Class oxWrapper
Private apiK$
Private hostnamE$
Private isConnected As Boolean
Public Sub New(urL$, apiKey$)
'hostnamE = "https://api.cloud.ox.security" '/api/apollo-gateway
hostnamE = urL
apiK = apiKey
isConnected = True
End Sub
Public Function getJSON(apiCall$) As Boolean
On Error GoTo errorcatch
Dim sInfo$ = "python"
If osType = "MacOSX" Or osType = "Linux" Then sInfo = "python3"
FileSystem.ChDir(pyDir)
Dim startInfo As New ProcessStartInfo
startInfo.FileName = sInfo
startInfo.Arguments = "python_examp.py " + apiCall
'startInfo.UseShellExecute = True
' Console.WriteLine("Executing>" + vbCrLf + startInfo.FileName + " " + startInfo.Arguments)
Dim callPython As System.Diagnostics.Process = Process.Start(startInfo)
' Process.Start(startInfo)
If callPython.WaitForExit(60000) = True Then
getJSON = True
FileSystem.ChDir(ogDir)
Exit Function
Else
Console.WriteLine("API Process timeout")
getJSON = False
FileSystem.ChDir(ogDir)
Exit Function
End If
errorcatch:
FileSystem.ChDir(ogDir)
getJSON = False
Console.WriteLine("ERROR: " & ErrorToString())
'Return getAPIData("/api/apollo-gateway", True, "")
End Function
Public Function getCommittingUsers(fileN$) As devDetail
getCommittingUsers = New devDetail
'getCommittingUsers.users = New List(Of committingUsers)
'getCommittingUsers.usersFromApi = New List(Of apiUsers)
Dim jsoN$ = streamReaderTxt(fileN)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").ToString
'Console.WriteLine(jsoN)
Return JsonConvert.DeserializeObject(Of devDetail)(jsoN)
End Function
Public Function integrationMapping(appCollection As Collection, bdCollection As Collection, mapType$) As String
Dim mP As bdMappingExport = New bdMappingExport
mP.externalTool = LCase(mapType) '"blackduck"
Dim K As Integer = 0
For K = 1 To appCollection.Count
Dim a$ = appCollection(K)
Dim b$ = bdCollection(K)
If Len(a) > 0 And Len(b) > 0 Then
Dim newMP As mappingProps = New mappingProps
newMP.externalToolProject = b
newMP.oxRepo = a
mP.mappingRepoToProject.Add(newMP)
End If
Next
Return JsonConvert.SerializeObject(mP)
End Function
' Writing the VARS files - consider bringing from main into wrapper
' set JSON object as *.variables.json file
Public Function jsonGetNewIssueDetailVars(issueInput As newIssueDetailRequestVARS) As String
Dim jsoN$ = JsonConvert.SerializeObject(issueInput)
Return jsoN
End Function
Public Function jsonGetNewTagVars(newTag As newTagRequestVARS) As String
Dim jsoN$ = JsonConvert.SerializeObject(newTag)
Return jsoN
End Function
Public Function jsonGetAppsVars(nAppList As appsRequestVARS) As String
Dim jsoN$ = JsonConvert.SerializeObject(nAppList)
Return jsoN
End Function
Public Function jsonGetIrrelevantAppsVars(nAppList As appsIrrelevantRequestVARS) As String
Dim jsoN$ = JsonConvert.SerializeObject(nAppList)
Return jsoN
End Function
Public Function jsonGetIssuesVars(giV As issueRequestVARS) As String
Dim jsoN$ = JsonConvert.SerializeObject(giV)
Return jsoN
End Function
Public Function jsonGetEditTagsVars(evR As editTagsRequestVARS) As String
Dim fullReq As editTagsReq = New editTagsReq
fullReq.input = evR
Dim jsoN$ = JsonConvert.SerializeObject(fullReq)
Return jsoN
End Function
Public Function returnGitLabRepos(fileN$) As List(Of glabRepo)
returnGitLabRepos = New List(Of glabRepo)
Dim jsoN$ = streamReaderTxt(fileN)
returnGitLabRepos = JsonConvert.DeserializeObject(Of List(Of glabRepo))(jsoN)
End Function
Public Function returnIssues(json$) As List(Of issueS)
returnIssues = New List(Of issueS)
Dim nD As JObject = JObject.Parse(json)
json = nD.SelectToken("data").SelectToken("getIssues").SelectToken("issues").ToString
returnIssues = JsonConvert.DeserializeObject(Of List(Of issueS))(json)
End Function
Public Function returnMediumIssues(json$) As List(Of issuesMedium)
returnMediumIssues = New List(Of issuesMedium)
Dim nD As JObject = JObject.Parse(json)
json = nD.SelectToken("data").SelectToken("getIssues").SelectToken("issues").ToString
returnMediumIssues = JsonConvert.DeserializeObject(Of List(Of issuesMedium))(json)
End Function
Public Function returnShortIssues(json$) As List(Of issueShort)
returnShortIssues = New List(Of issueShort)
Dim nD As JObject = JObject.Parse(json)
json = nD.SelectToken("data").SelectToken("getIssues").SelectToken("issues").ToString
returnShortIssues = JsonConvert.DeserializeObject(Of List(Of issueShort))(json)
End Function
Public Function getTagId(jSon$) As String
getTagId = ""
Dim nD As JObject = JObject.Parse(jSon)
jSon = nD.SelectToken("data").SelectToken("addTags").SelectToken("tags").ToString
Dim tagObj As List(Of oxTag) = New List(Of oxTag)
tagObj = JsonConvert.DeserializeObject(Of List(Of oxTag))(jSon)
If tagObj.Count = 0 Then Exit Function 'add was unsuccessful
getTagId = tagObj(0).tagId
End Function
Public Function getListIssues(fileN$) As listIssues
getListIssues = New listIssues
Dim jsoN$ = streamReaderTxt(fileN)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getIssues").ToString
getListIssues = JsonConvert.DeserializeObject(Of listIssues)(jsoN)
End Function
Public Function getListAppsPaging(fileN$) As listApps
getListAppsPaging = New listApps
Dim jsoN$ = streamReaderTxt(fileN)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getApplications").ToString
getListAppsPaging = JsonConvert.DeserializeObject(Of listApps)(jsoN)
End Function
Public Function getConnectionsFromJson(jsoN$) As List(Of connectorFamily)
getConnectionsFromJson = New List(Of connectorFamily)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getConnectorsByFamily").ToString
getConnectionsFromJson = JsonConvert.DeserializeObject(Of List(Of connectorFamily))(jsoN)
End Function
Public Function getAppInfoShort(jsoN$) As List(Of oxAppshort)
getAppInfoShort = New List(Of oxAppshort)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getApplications").SelectToken("applications").ToString
getAppInfoShort = JsonConvert.DeserializeObject(Of List(Of oxAppshort))(jsoN)
End Function
Public Function getAppIrrelevant(jsoN$) As List(Of oxAppIrrelevant)
getAppIrrelevant = New List(Of oxAppIrrelevant)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getApplications").SelectToken("applications").ToString
getAppIrrelevant = JsonConvert.DeserializeObject(Of List(Of oxAppIrrelevant))(jsoN)
End Function
Public Function getAllTags(jsoN$) As List(Of oxTag)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getAllTags").SelectToken("tags").ToString
getAllTags = JsonConvert.DeserializeObject(Of List(Of oxTag))(jsoN)
End Function
Public Function returnTagId(taG$, tagList As List(Of oxTag)) As String
returnTagId = ""
taG = LCase(taG)
For Each T In tagList
If LCase(T.displayName) = taG Then
Return T.tagId
End If
Next
End Function
Public Function returnAppShortByName(appName$, appList As List(Of oxAppshort)) As oxAppshort
returnAppShortByName = New oxAppshort
appName = LCase(appName)
For Each T In appList
If LCase(T.appName) = appName Then
Return T
End If
Next
End Function
Public Function getUserLogEntries(jsoN$) As List(Of oxUserLogEntry)
getUserLogEntries = New List(Of oxUserLogEntry)
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getLogs").ToString
getUserLogEntries = JsonConvert.DeserializeObject(Of List(Of oxUserLogEntry))(jsoN)
End Function
Public Function getUserFilterEntries(jsoN$) As oxUserLogFilter
getUserFilterEntries = New oxUserLogFilter
Dim nD As JObject = JObject.Parse(jsoN)
jsoN = nD.SelectToken("data").SelectToken("getLogsFilters").ToString
getUserFilterEntries = JsonConvert.DeserializeObject(Of oxUserLogFilter)(jsoN)
End Function
End Class
Public Class oxUserLogFilter
Public logTypes As List(Of oxLogFilterProps)
Public logNames As List(Of oxLogFilterProps)
Public userEmails As List(Of oxLogFilterProps)
End Class
Public Class oxLogFilterProps
Public count As Integer
Public label As String
End Class
Public Class oxUserLogEntry
Public logType As String
Public logName As String
Public userEmail As String
Public domain As String
Public [date] As DateTime
End Class
Public Class bdMappingExport
' {
Public externalTool As String
Public mappingRepoToProject As List(Of mappingProps)
Public Sub New()
mappingRepoToProject = New List(Of mappingProps)
End Sub
End Class
Public Class mappingProps
Public externalToolProject As String
Public externalToolProjectVersionToSkipp As List(Of extProjProps)
Public externalToolProjectVersionToInclude As List(Of extProjProps)
Public oxRepo As String
Public Sub New()
externalToolProjectVersionToSkipp = New List(Of extProjProps)
externalToolProjectVersionToInclude = New List(Of extProjProps)
End Sub
End Class
Public Class extProjProps
Public versionName As String
'"externalTool": "blackduck",
'"mappingRepoToProject": [
' {
' "externalToolProject": "",
' "externalToolProjectVersionToSkipp": [
' {
' "versionName": ""
' }
' ],
' "externalToolProjectVersionToInclude": [
' {
' "versionName": ""
' }
' ],
' "oxRepo": ""
' },
' {
' "externalToolProject": "",
' "externalToolProjectVersionToSkipp": [
' {
' "versionName": ""
' }
' ],
' "e'xternalToolProjectVersionToInclude": [
' {'
' "versionName": ""'
' }
' ],
''' "oxRepo": ""
'' }
' ]
'}
End Class
Public Class oxAppIrrelevant
' "appId": "51548962",
' "appName": "WebGoat",
' "lastCodeChange": "1698193900331",
' "irrelevantReasons": [
' "No code changes in the last 6 months"
' ],
' "overrideRelevance": "default",
' "type": "GitLab",
' "fakeApp": false
Public appId As String
Public appName As String
Public link As String
Public lastCodeChange As String
Public irrelevantReasons As List(Of String)
Public overrideRelevance As String
Public [type] As String
Public fakeApp As Boolean
Public Sub New()
irrelevantReasons = New List(Of String)
End Sub
End Class
Public Class devDetail
Public getOrgUsersByOrgId As getOrgUsers
Public Sub New()
getOrgUsersByOrgId = New getOrgUsers
End Sub
End Class
Public Class getOrgUsers
Public developersCount As Integer
Public developersCountAPI As Integer
Public developersCountCommits As Integer
Public display_name As String
Public users As List(Of committingUsers)
Public usersFromApi As List(Of apiUsers)
Public Sub New()
users = New List(Of committingUsers)
usersFromApi = New List(Of apiUsers)
End Sub
End Class
Public Class committingUsers
Public committerEmail As String
Public committerAuthor As String
Public link As String
Public latestCommitDate As String
Public gitType As String
Public filtered As Boolean
End Class
Public Class apiUsers
Public id As String
Public username As String
Public name As String
End Class
'GitLab get_projects 8/14
'Ayman provided JSON for auto-tagging functions of NAMESPACE/group
Public Class glabRepo
Public name As String
Public name_with_namespace As String
Public web_url As String
Public [namespace] As glNamespace
End Class
Public Class glNamespace
Public name As String
Public path As String
Public kind As String
End Class
Public Class oxAppshort
Public appId As String
Public appName As String
Public link As String
Public tags As List(Of oxTag)
Public Function tagExist(Optional ByVal tagId$ = "", Optional ByVal tagDisplayName$ = "") As Boolean
tagExist = False
If Len(tagDisplayName) Then GoTo doName
If Len(tagId) = 0 Then
Exit Function
End If
For Each T In Me.tags
If T.tagId = tagId Then
tagExist = True
Exit Function
End If
Next
doName:
For Each T In Me.tags
If LCase(T.displayName) = LCase(tagDisplayName) Then
tagExist = True
Exit Function
End If
Next
End Function
End Class
Public Class oxTag
Public tagId As String
Public name As String
Public displayName As String
Public tagType As String
Public createdBy As String
Public isOxTag? As Boolean
End Class
Public Class oxPolicy
' "data": {
' "getPoliciesByCategoryIdAndProfileId": {
' "policies": [
' {
' "id": "64f9c9a7f59f29539740bf86",
' "policyId": "oxPolicy_securityCloudScan_100",
' "ruleId": "oxRule_securityCloudScan_1",
' "name": "Cloud security (CSPM) alerts should not occur",
' "catId": 15,
' "description": "CSPM (Cloud Security Posture Management) issues should not be present.",
' "detailedDescription": "Cloud misconfigurations can lead to catastrophic security issues like breaches, exposure of data and exposure of infrastructure. In 2021, Codecov published a public Docker image containing static credentials for a GCP service account. These credentials were used to replace the install script hosted in Google Cloud Storage with a malicious script stealing environment variables.",
' "severity": null,
Public categorY As String
Public id As String
Public name As String
Public description As String
Public detailedDescription As String
End Class
Public Class gQLgetIssues_qry
Public query As String
'Public variables As getIssuesInput
End Class
Public Class gqlVars
Public getIssuesInput As issueFilterClass
Public Sub New()
getIssuesInput = New issueFilterClass
End Sub
End Class
Public Class issueFilterClass
Public owners As List(Of String)
Public offset As Integer
Public limit As Integer
Public filters As issueFilter
Public sort As sortFilter
Public dateRange As gqlDateRange
Public isDemo As Boolean
Public Sub New()
offset = 0
limit = 1000
Me.owners = New List(Of String)
Me.filters = New issueFilter
Me.sort = New sortFilter
Me.dateRange = New gqlDateRange
isDemo = True
With Me.filters.criticality
.Add("Critical")
.Add("High")
.Add("Medium")
.Add("Low")
.Add("Info")
End With
With Me.sort
.fields.Add("Severity")
.order.Add("DESC")
End With
Me.dateRange.from = 1684993734665
Me.dateRange.to = 9999999999999
End Sub
End Class
Public Class gqlDateRange
Public [from] As Long
Public [to] As Long
End Class
Public Class sortFilter
Public fields As List(Of String)
Public order As List(Of String)
Public Sub New()
fields = New List(Of String)
order = New List(Of String)
End Sub
End Class
Public Class issueFilter
Public criticality As List(Of String)
Public Sub New()
criticality = New List(Of String)
End Sub
End Class
Public Class listIssues
' "totalIssues": 560,
' "totalFilteredIssues": 30,
' "totalResolvedIssues": 0,
' "offset": 50
' Public issues As List(Of oxIssueS)
Public totalIssues As Long
Public totalFilteredIssues As Long
Public totalResolvedIssues As Long
Public offset As Long
End Class
Public Class listApps
' "totalIssues": 560,
' "totalFilteredIssues": 30,
' "totalResolvedIssues": 0,
' "offset": 50
' Public issues As List(Of oxIssueS)
Public total As Long
Public totalFilteredApps As Long
Public totalIrrelevantApps As Long
Public offset As Long
End Class
Public Class scaCVE
' "'data": {
' "getSingleIssueInfo": {
' "id": "66ffbc200f1b5c7521a05816",
' "issueId": "584352228-oxPolicy_securityScan_120-org.springframework.boot:spring-boot-starter-web_2.1.2.RELEASE",
' "scaVulnerabilities": [
' {
' "cve": "CVE-2022-22965",
' "cveLink": "https://nvd.nist.gov/vuln/detail/CVE-2022-22965",
' "cvsVer": "9.8",
' "libName": "spring-boot-starter-web",
' "libVersion": "2.1.2.RELEASE",
' "exploitInTheWildLink": "http://packetstormsecurity.com/files/166713/Spring4Shell-Code-Execution.html",
' "dateDiscovered": "Fri Apr 01 2022",
' "minorVerWithFix": "2.6.6",
' "majorVerWithFix": "Not Available",
' "originalSeverity": "Critical"
' },
' {
' "cve": "CVE-2020-1938",
Public id As String
Public issueId As String
Public sbom As sbomInfo
Public scaVulnerabilities As List(Of scaVuln)
End Class
Public Class scaVuln
Public cve As String
Public cveLink As String
Public cvsVer As String
Public libName As String
Public libVersion As String
Public exploitInTheWildLink As String
Public dateDiscovered As String
Public minorVerWithFix As String
Public majorVerWithFix As String
Public originalSeverity As String
End Class
Public Class sbomInfo
' "sbom": {
' "id": "66ffbc1f0f1b5c7521a048dd",
' "libId": "maven|org.springframework.boot:spring-boot-starter-web|2.1.2.RELEASE",
' "license": "Apache-2.0",
' "appName": "OX-Security-Demo/Bank-Website",
' "dependencyType": "Direct",
' "pkgName": "org.springframework.boot:spring-boot-starter-web",
' "libraryName": "org.springframework.boot:spring-boot-starter-web",
' "libraryVersion": "2.1.2.RELEASE",
' "packageManager": "maven"
'' },
Public id As String
Public libId As String
Public license As String
Public appName As String
Public dependencyType As String
Public pkgName As String
Public libraryName As String
Public libraryVersion As String
Public packageManager As String
End Class
Public Class singleIssue
'dependencyGraph
'sbom
Public id As String
Public issueId As String
Public gptInfo As oxGPT
Public isGPTFixAvailable As Boolean
Public name As String
Public scanId As String
Public created As Long
Public scanDate As Long
Public mainTitle As String
Public secondTitle As String
Public description As String
Public severity As String
Public owners As List(Of String)
Public ruleId As String
Public originalToolSeverity As String
Public exclusionCategory As String
Public occurrences As Integer
Public comment As String
Public learnMore As List(Of String)
Public exclusionId As String
Public resource As issueResources
Public isMonoRepoChild As Boolean
Public monoRepoParent As String
Public isFixAvailable As Boolean
'Public prDeatils As String
'public autofix
Public extraInfo As List(Of kvPair)
'Public lots of APP info here
Public app As issueApp
Public policy As oxPolicy
Public category As oxCategory
Public isPRAvailable As Boolean
'public aggregations
Public recommendation As String
Public violationInfoTitle As String
Public sourceTools As List(Of String)
Public cwe As List(Of String)
Public cweList As List(Of cweInfo)
Public severityChangedReason As List(Of sevFactor)
Public tickets As List(Of String)
Public oscarData As List(Of oxOscar)
Public Sub New()
sourceTools = New List(Of String)
End Sub
Public Function numSevFactors(Optional ByVal numReachable As Boolean = False, Optional ByVal numExploitable As Boolean = False, Optional ByVal damagE As Boolean = False) As Integer
numSevFactors = Me.severityChangedReason.Count
If numReachable = False And numExploitable = False And damagE = False Then
Exit Function
End If
numSevFactors = 0
For Each SF In Me.severityChangedReason
If numReachable = True And SF.changeCategory = "Reachable" Then numSevFactors += 1
If numExploitable = True And SF.changeCategory = "Exploitable" Then numSevFactors += 1
If damagE = True And SF.changeCategory = "Damage" Then numSevFactors += 1
Next
End Function
Public Function increasedSev() As Boolean
increasedSev = False
If returnSeverityNum(Me.originalToolSeverity) < returnSeverityNum(Me.severity) Then increasedSev = True
End Function
Public Function decreasedSev() As Boolean
decreasedSev = False
If returnSeverityNum(Me.originalToolSeverity) > returnSeverityNum(Me.severity) Then decreasedSev = True
End Function
End Class
Public Class issueResources
Public id As String
Public [type] As String
End Class
Public Class issueApp
' "app": {
' "id": "*aem-dispatcher",
' "name": "*aem-dispatcher",
' "businessPriority": 31.890410958904113,
' "type": "Git",
' "originBranchName": "",
' "repoId": null,
Public id As String
Public name As String
Public businessPriority As Long
End Class
Public Class oxOscar
Public id As String
Public name As String
Public description As String
Public url As String
End Class
Public Class sevFactor
Public changeNumber As Decimal
Public reason As String
Public shortName As String
Public changeCategory As String
Public extraInfo As List(Of extraInfoSF)
End Class
Public Class extraInfoSF
Public [key] As String
Public link As String
Public snippet As oxSnippet
End Class
Public Class oxSnippet
Public snippetLineNumber As Long
Public language As String
Public [text] As String
Public filename As String
End Class
Public Class cweInfo
Public name As String
Public description As String
Public url As String
End Class
Public Class oxGPT
Public createdAt As String
Public user As String
Public gptResponse As String
End Class
Public Class kvPair
Public key As String
Public value As String
End Class
'Public Class oxCategory
' Public name As String
' Public categoryId As Integer
'End Class
'Public Class oxPolicy
' Public id As String
' Public name As String
' Public detailedDescription As String
'End Class
Public Class issueShort
' query GetIssues($isDemo: Boolean, $getIssuesInput: IssuesInput) {
' getIssues(isDemo: $isDemo, getIssuesInput: $getIssuesInput) {
' issues {
' id
' issueId
' mainTitle
' created
' scanId
' createdAt
' compliance {
' standard
' control
' category
' }
' severityChangedReason {
' changeNumber
' reason
' shortName
' changeCategory
' }
Public id As String
Public issueId As String
Public scanId As String
Public created As Long
Public createdAt As Long
Public compliance As List(Of oxCompliance)
Public severityChangedReason As List(Of sevFactor)
End Class
Public Class issueS
' {
' improvements in API flexibility removing need for 'issuesShort' 'issueS' 'issuesMedium' etc
' 9/22 changes begin - long term dynamic JSON building for purpose-built processes? or just reuse files
' new structure
' query GetIssues($isDemo: Boolean, $getIssuesInput: IssuesInput) {
'g'etIssues(isDemo: $isDemo, getIssuesInput: $getIssuesInput) {
' issues {
' id
' issueId
' mainTitle
'' created
' scanId
' createdAt
' originalToolSeverity
'severity
' occurrences
' sourceTools
'' resource {
' id
' type
'}
' category {
' name
' categoryId
''}
' app {
' id
' name
' businessPriority
' }
' compliance {
' standard
' control
'' category
' description
' }
' severityChangedReason {
' changeNumber
'' reason
' shortName
' changeCategory
' }
Public id As String
Public issueId As String
Public mainTitle As String
Public secondTitle As String
Public name As String
Public created As Long
Public scanId As String
Public owners As List(Of String)
Public occurrences As Integer
Public comment As String
Public originalToolSeverity As String
'Public resource As issueResources
Public severity As String
Public createdAt As Long
Public policy As oxPolicy
Public category As oxCategory
Public app As oxApp
Public sourceTools As List(Of String)
Public compliance As List(Of oxCompliance) 'this exists only inside getIssuesComp file
Public severityChangedReason As List(Of sevFactor)
Public Sub New()
sourceTools = New List(Of String)
End Sub
Public Function numSevFactors(Optional ByVal numReachable As Boolean = False, Optional ByVal numExploitable As Boolean = False, Optional ByVal damagE As Boolean = False) As Integer
numSevFactors = Me.severityChangedReason.Count
If numReachable = False And numExploitable = False And damagE = False Then
Exit Function
End If
numSevFactors = 0
For Each SF In Me.severityChangedReason
If numReachable = True And SF.changeCategory = "Reachable" Then numSevFactors += 1
If numExploitable = True And SF.changeCategory = "Exploitable" Then numSevFactors += 1
If damagE = True And SF.changeCategory = "Damage" Then numSevFactors += 1
Next
End Function
Public Function increasedSev() As Boolean
increasedSev = False
If returnSeverityNum(Me.originalToolSeverity) < returnSeverityNum(Me.severity) Then increasedSev = True
End Function
Public Function decreasedSev() As Boolean
decreasedSev = False
If returnSeverityNum(Me.originalToolSeverity) > returnSeverityNum(Me.severity) Then decreasedSev = True
End Function
End Class
Public Class oxCompliance
Public standard As String
Public control As String
Public category As String
Public description As String
End Class
Public Class oxCategory
Public name As String
Public categoryId As Integer
End Class
Public Class oxApp
Public id As String
Public name As String
Public businessPriority As Long
Public [type] As String
Public fakeApp As Boolean
End Class
Public Class issuesMedium
Public id As String
Public issueId As String
Public mainTitle As String
Public secondTitle As String
Public name As String
Public created As Long
Public createdAt As Long
Public scanId As String
Public owners As List(Of String)
Public occurrences As Integer
Public severity As String
Public originalToolSeverity As String
Public aggregations As oxAgg
Public policy As oxPolicy
Public category As oxCategory
Public app As oxApp
Public severityChangedReason As List(Of sevFactor)
End Class
Public Class oxAgg
Public summary As oxSumm
Public [type] As String
Public items As List(Of oxSource)
End Class
Public Class oxSource
Public source As String
Public commitBy As String
End Class