@@ -893,15 +893,19 @@ class EngineScriptDashboard {
893893
894894 // For logs, we allow more characters but still remove dangerous patterns
895895 // Keep line breaks and basic formatting for readability but remove XSS vectors
896- return input
897- . replace ( / \0 / g, '' ) // Remove null bytes first
898- . replace ( / [ < > & " ' ` ] / g, '' ) // Remove HTML/XML special characters that could break out of attributes
899- . replace ( / j a v a s c r i p t : / gi, '' ) // Remove javascript: protocol
900- . replace ( / d a t a : / gi, '' ) // Remove data: protocol
901- . replace ( / v b s c r i p t : / gi, '' ) // Remove vbscript: protocol
902- . replace ( / o n \w + = / gi, '' ) // Remove event handlers
903- . replace ( / [ \x00 - \x08 \x0B \x0C \x0E - \x1F \x7F ] / g, '' ) // Remove control chars but keep \t, \n, \r
904- . substring ( 0 , 50000 ) ; // Reasonable log size limit
896+ let previous ;
897+ do {
898+ previous = input ;
899+ input = input
900+ . replace ( / \0 / g, '' ) // Remove null bytes first
901+ . replace ( / [ < > & " ' ` ] / g, '' ) // Remove HTML/XML special characters that could break out of attributes
902+ . replace ( / j a v a s c r i p t : / gi, '' ) // Remove javascript: protocol
903+ . replace ( / d a t a : / gi, '' ) // Remove data: protocol
904+ . replace ( / v b s c r i p t : / gi, '' ) // Remove vbscript: protocol
905+ . replace ( / o n \w + = / gi, '' ) // Remove event handlers
906+ . replace ( / [ \x00 - \x08 \x0B \x0C \x0E - \x1F \x7F ] / g, '' ) ; // Remove control chars but keep \t, \n, \r
907+ } while ( input !== previous ) ;
908+ return input . substring ( 0 , 50000 ) ; // Reasonable log size limit
905909 }
906910
907911 setTextContent ( elementId , content ) {
0 commit comments