Skip to content

Commit 7a01a39

Browse files
committed
Simplify
1 parent dfb1f9c commit 7a01a39

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

webview-ui/src/utils/command-validation.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)