File tree Expand file tree Collapse file tree 5 files changed +77
-1
lines changed Expand file tree Collapse file tree 5 files changed +77
-1
lines changed Original file line number Diff line number Diff line change 5757 "@types/node" : " ^11.13.2" ,
5858 "@types/recursive-readdir" : " ^2.2.0" ,
5959 "debug" : " ^4.1.1" ,
60+ "fast-redact" : " ^1.5.0" ,
6061 "file-type" : " ^10.10.0" ,
6162 "got" : " ^9.6.0" ,
6263 "mime-types" : " ^2.1.22" ,
Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ export class TwilioServerlessApiClient extends events.EventEmitter {
460460 message : 'Gathering Functions and Assets to deploy' ,
461461 } ) ;
462462
463- log ( 'Deploy config %O ' , deployConfig ) ;
463+ log ( 'Deploy config %P ' , deployConfig ) ;
464464
465465 const searchConfig : SearchConfig = { } ;
466466 if ( deployConfig . functionsFolderName ) {
Original file line number Diff line number Diff line change 1+ declare module 'fast-redact' {
2+ function createRedactor ( options : { } ) : < T > ( val : T ) => string ;
3+
4+ export = createRedactor ;
5+ }
Original file line number Diff line number Diff line change 44 *
55 * Main entry point of the project
66 */
7+
8+ import './utils/debug' ;
9+
710export * from './api' ;
811export * from './client' ;
912export * from './types/index' ;
Original file line number Diff line number Diff line change 1+ import debug from 'debug' ;
2+ import fastRedact from 'fast-redact' ;
3+
4+ type RedactorFunction < T extends object > = ( val : T ) => T ;
5+
6+ function prefixAllEntriesWithWildcard ( values : string [ ] ) : string [ ] {
7+ const result = [ ] ;
8+
9+ for ( let val of values ) {
10+ result . push ( val ) ;
11+ result . push ( `*.${ val } ` ) ;
12+ }
13+
14+ return result ;
15+ }
16+
17+ export const generalRedactor = fastRedact ( {
18+ paths : [
19+ 'env.*' ,
20+ 'pkgJson.*' ,
21+ ...prefixAllEntriesWithWildcard ( [
22+ 'authToken' ,
23+ 'apiSecret' ,
24+ 'username' ,
25+ 'password' ,
26+ 'cookies' ,
27+ 'AUTH_TOKEN' ,
28+ 'API_SECRET' ,
29+ 'TWILIO_AUTH_TOKEN' ,
30+ 'TWILIO_API_SECRET' ,
31+ ] ) ,
32+ ] ,
33+ } ) ;
34+
35+ export const allPropertiesRedactor = fastRedact ( {
36+ paths : [ '*' ] ,
37+ } ) ;
38+
39+ debug . formatters . P = function protectedFormatterMultiline ( v : any ) : string {
40+ if ( typeof v === 'object' ) {
41+ v = JSON . parse ( generalRedactor ( v ) ) ;
42+ }
43+
44+ return debug . formatters . O . bind ( debug ) ( v ) ;
45+ } ;
46+
47+ debug . formatters . p = function protectedFormatterSameline ( v : any ) : string {
48+ if ( typeof v === 'object' ) {
49+ v = JSON . parse ( generalRedactor ( v ) ) ;
50+ }
51+
52+ return debug . formatters . o . bind ( debug ) ( v ) ;
53+ } ;
54+
55+ debug . formatters . R = function redactedFormatterMultiline ( v : any ) : string {
56+ if ( typeof v === 'object' ) {
57+ v = JSON . parse ( allPropertiesRedactor ( v ) ) ;
58+ }
59+ return debug . formatters . O . bind ( debug ) ( v ) ;
60+ } ;
61+
62+ debug . formatters . r = function redactedFormatterSameline ( v : any ) : string {
63+ if ( typeof v === 'object' ) {
64+ v = JSON . parse ( allPropertiesRedactor ( v ) ) ;
65+ }
66+ return debug . formatters . o . bind ( debug ) ( v ) ;
67+ } ;
You can’t perform that action at this time.
0 commit comments