File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,30 @@ if (actions.includes('test')) {
353353 }
354354 }
355355
356+ // Always redact sensitive data, even if some tests failed
357+ try {
358+ const logDir = path . join ( e2eDir , 'maestro-logs' ) ;
359+ if ( fs . existsSync ( logDir ) ) {
360+ const redactFiles = ( dir ) => {
361+ for ( const entry of fs . readdirSync ( dir , { withFileTypes : true } ) ) {
362+ const fullPath = path . join ( dir , entry . name ) ;
363+ if ( entry . isDirectory ( ) ) {
364+ redactFiles ( fullPath ) ;
365+ } else {
366+ const content = fs . readFileSync ( fullPath , 'utf8' ) ;
367+ if ( content . includes ( sentryAuthToken ) ) {
368+ fs . writeFileSync ( fullPath , content . replaceAll ( sentryAuthToken , '[REDACTED]' ) ) ;
369+ }
370+ }
371+ }
372+ } ;
373+ redactFiles ( logDir ) ;
374+ console . log ( 'Redacted sensitive data from logs' ) ;
375+ }
376+ } catch ( error ) {
377+ console . warn ( 'Failed to redact sensitive data from logs:' , error . message ) ;
378+ }
379+
356380 if ( failedFlows . length > 0 ) {
357381 console . error ( `\nFailed flows: ${ failedFlows . join ( ', ' ) } ` ) ;
358382 process . exit ( 1 ) ;
You can’t perform that action at this time.
0 commit comments