Potential fix for code scanning alert no. 189: Inefficient regular expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
John Richmond 2025-09-29 20:55:49 -07:00 committed by GitHub
parent 37faf01202
commit c9c4333589
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,7 +127,7 @@ export function containsDangerousSubstitution(source: string): boolean {
// Check for $"..." string interpolation with command substitution
// $"..." is a bash feature for translated strings that allows command substitution inside
// Handle escaped quotes within $"...": use (?:\\.|[^"])* to avoid premature termination on \"
const bashTranslatedStringWithSubstitution = /\$"(?:\\.|[^"])*(?:\$\(|`)(?:\\.|[^"])*"/.test(source)
const bashTranslatedStringWithSubstitution = /\$"(?:\\.|[^\\"])*(?:\$\(|`)(?:\\.|[^\\"])*"/.test(source)
// Return true if any dangerous pattern is detected
return (