File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " securelog-scan" ,
3- "version" : " 3.0.21 " ,
3+ "version" : " 3.0.22 " ,
44 "description" : " A CLI tool to scan codebases for potential secrets." ,
55 "main" : " dist/index.js" ,
66 "author" : {
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ export const maskAndRedactSensitiveData = async (
5353 const { scan } = detector ;
5454 const scanResponse = await scan ( false , options . rawValue as string ) ;
5555 if ( scanResponse && scanResponse . rawValue ) {
56+ /***
57+ * this replaces the secrets in the string to a masked one should incase there
58+ * are multiple secrets in the string, it replaces them one by one based on how
59+ * many secrets was detected
60+ */
5661 modifiedValue = modifiedValue ?. replaceAll (
5762 scanResponse . rawValue as string ,
5863 maskString ( scanResponse . rawValue as string , {
@@ -61,6 +66,16 @@ export const maskAndRedactSensitiveData = async (
6166 } )
6267 ) ;
6368
69+ /**
70+ * this masks the rawValue thats inside the scanResult based on the user option
71+ */
72+ if ( options . maskSecretRawValue ) {
73+ scanResponse . rawValue = maskString ( scanResponse . rawValue as string , {
74+ maskValue : options . maskedValue ,
75+ visibleChars : options . visibleChars ,
76+ } ) ;
77+ }
78+
6479 return scanResponse ;
6580 }
6681 } )
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export interface ScanStringOptions {
2323 maskedValue ?: string ;
2424 visibleChars ?: number ;
2525 customDetectors ?: DetectorConfig [ ] ;
26+ maskSecretRawValue ?: boolean ;
2627}
2728
2829export interface DecayOptions {
@@ -94,10 +95,10 @@ export interface DataFormat {
9495}
9596
9697export type RedactionPattern = {
97- pattern : string ; // RE2 compatible pattern
98+ pattern : string ; // RE2 compatible pattern
9899 replacement : string ;
99100 description ?: string ;
100- }
101+ } ;
101102
102103export type RedactionConfig = {
103104 [ key : string ] : RedactionPattern ;
You can’t perform that action at this time.
0 commit comments