This release teaches the PowerShell parser about here-strings (@'…'@ and @"…"@), which fixes both a false positive on quoted source text and several destructive commands that slipped through unchecked.
Fixed
- Fixed a false positive where the body of a PowerShell here-string was analyzed as code, so piping source text such as
s = 'var x = originalArmy.Key;'through@'…'@ | python -was blocked as sensitive-path access. This applies when the command is analyzed as PowerShell — thepowershellroute or apowershell -Commandwrapper; theautoroute still denies the bare form. (#327) - Fixed missed detections after a here-string whose body contains an apostrophe. Commands like
@'…don't…'@; Remove-Item -Recurse -Force C:\and@'…don't…'@; Get-Content id.keywere allowed and are now blocked. - Fixed detection of destructive commands handed to
Invoke-Expressionas a here-string. - Improved here-string handling for carriage-return line endings and for expandable
@"…"@bodies, so a path such as$env:USERPROFILE\.ssh\configwritten in a here-string is resolved and blocked. - Fixed a PowerShell double-quoted string ending in a backslash, such as
Get-Content "C:\tmp\" ; Get-Content id.key, leaving the rest of the command unchecked by the secret guard. - Allowed a here-string that only mentions a destructive command in its text, such as a Makefile body containing
rm -rfpiped toSet-Content.