@@ -432,42 +432,6 @@ export function getCommandDecision(
432432
433433 // Check if subshells contain denied prefixes
434434 if ( ( command . includes ( "$(" ) || command . includes ( "`" ) ) && deniedCommands ?. length ) {
435- // Extract subshell content and check if it contains denied prefixes
436- let match : RegExpExecArray | null
437-
438- // Check $() subshells
439- const dollarRegex = / \$ \( ( .* ?) \) / g
440- while ( ( match = dollarRegex . exec ( command ) ) !== null ) {
441- const subshellContent = match [ 1 ] . trim ( )
442- // Check if the subshell content matches any denied prefix
443- if (
444- deniedCommands . some ( ( denied ) => {
445- const lowerDenied = denied . toLowerCase ( )
446- const lowerContent = subshellContent . toLowerCase ( )
447- return lowerContent . startsWith ( lowerDenied )
448- } )
449- ) {
450- return "auto_deny"
451- }
452- }
453-
454- // Check `` subshells
455- const backtickRegex = / ` ( .* ?) ` / g
456- while ( ( match = backtickRegex . exec ( command ) ) !== null ) {
457- const subshellContent = match [ 1 ] . trim ( )
458- // Check if the subshell content matches any denied prefix
459- if (
460- deniedCommands . some ( ( denied ) => {
461- const lowerDenied = denied . toLowerCase ( )
462- const lowerContent = subshellContent . toLowerCase ( )
463- return lowerContent . startsWith ( lowerDenied )
464- } )
465- ) {
466- return "auto_deny"
467- }
468- }
469-
470- // Also check if the main command contains denied prefixes
471435 const mainCommandLower = command . toLowerCase ( )
472436 if ( deniedCommands . some ( ( denied ) => mainCommandLower . includes ( denied . toLowerCase ( ) ) ) ) {
473437 return "auto_deny"
0 commit comments