File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,25 @@ export class LoggerController extends AdaptableController {
46
46
}
47
47
48
48
maskSensitiveUrl ( urlString ) {
49
- const password = url . parse ( urlString , true ) . query . password ;
50
-
51
- if ( password ) {
52
- urlString = urlString . replace ( 'password=' + encodeURIComponent ( password ) , 'password=********' ) ;
49
+ const urlObj = url . parse ( urlString , true ) ;
50
+ const query = urlObj . query ;
51
+ let sanitizedQuery = '?' ;
52
+
53
+ for ( const key in query ) {
54
+ if ( key !== 'password' ) {
55
+ // normal value
56
+ sanitizedQuery += key + '=' + query [ key ] + '&' ;
57
+ } else {
58
+ // password value, redact it
59
+ sanitizedQuery += key + '=' + '********' + '&' ;
60
+ }
53
61
}
54
- return urlString ;
62
+
63
+ // trim last character, ? or &
64
+ sanitizedQuery = sanitizedQuery . slice ( 0 , - 1 ) ;
65
+
66
+ // return original path name with sanitized params attached
67
+ return urlObj . pathname + sanitizedQuery ;
55
68
}
56
69
57
70
maskSensitive ( argArray ) {
You can’t perform that action at this time.
0 commit comments