@@ -13,6 +13,7 @@ import {
13
13
Occurrence ,
14
14
Validity ,
15
15
} from "./api-types" ;
16
+ import { pluralize } from "../utils" ;
16
17
17
18
const validityDisplayName : Record < Validity , string > = {
18
19
unknown : "Unknown" ,
@@ -45,6 +46,7 @@ function filterUriOccurrences(occurrences: Occurrence[]): Occurrence[] {
45
46
* @param results ggshield scan results
46
47
* @returns incidents diagnostics
47
48
*/
49
+
48
50
export function parseGGShieldResults (
49
51
results : GGShieldScanResults ,
50
52
) : Diagnostic [ ] {
@@ -63,6 +65,22 @@ export function parseGGShieldResults(
63
65
new Position ( occurrence . line_start - 1 , occurrence . index_start ) ,
64
66
new Position ( occurrence . line_end - 1 , occurrence . index_end ) ,
65
67
) ;
68
+
69
+ let vaultInfo = "" ;
70
+
71
+ if ( incident . secret_vaulted ) {
72
+ if ( incident . vault_path_count !== null ) {
73
+ vaultInfo += `Secret found in vault: YES (${ incident . vault_path_count } ${ pluralize ( incident . vault_path_count , "location" ) } )
74
+ ├─ Vault Type: ${ incident . vault_type }
75
+ ├─ Vault Name: ${ incident . vault_name }
76
+ └─ Secret Path: ${ incident . vault_path } ` ;
77
+ } else {
78
+ vaultInfo += "Secret found in vault: YES" ;
79
+ }
80
+ } else {
81
+ vaultInfo += "Secret found in vault: NO" ;
82
+ }
83
+
66
84
let diagnostic = new Diagnostic (
67
85
range ,
68
86
`ggshield: ${ occurrence . type }
@@ -73,11 +91,11 @@ Known by GitGuardian dashboard: ${incident.known_secret ? "YES" : "NO"}
73
91
Total occurrences: ${ incident . total_occurrences }
74
92
Incident URL: ${ incident . incident_url || "N/A" }
75
93
Secret SHA: ${ incident . ignore_sha }
76
- Secret in Secrets Manager: ${ incident . secret_vaulted ? "YES" : "NO" } `,
94
+ ${ vaultInfo } `,
77
95
DiagnosticSeverity . Warning ,
78
96
) ;
79
97
80
- diagnostic . source = "gitguardian " ;
98
+ diagnostic . source = "\ngitguardian " ;
81
99
diagnostics . push ( diagnostic ) ;
82
100
} ,
83
101
) ;
0 commit comments