From b38cd51338a9f30714e4e18aa6b488553d407449 Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Wed, 5 Aug 2026 15:56:19 +0300 Subject: [PATCH] fix(perception): support worker powershell runtime --- scripts/Invoke-M4DetectorShadow.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/Invoke-M4DetectorShadow.ps1 b/scripts/Invoke-M4DetectorShadow.ps1 index 8545f59..960f0ab 100644 --- a/scripts/Invoke-M4DetectorShadow.ps1 +++ b/scripts/Invoke-M4DetectorShadow.ps1 @@ -114,10 +114,17 @@ function Write-Utf8NoBom([string]$Path, [string]$Value) { } function Get-DirectoryTreeSha256([string]$Root, [object[]]$Files) { + $rootPrefix = $Root.TrimEnd("\") + "\" $rows = @( foreach ($file in $Files) { + if (-not $file.FullName.StartsWith( + $rootPrefix, + [StringComparison]::OrdinalIgnoreCase + )) { + throw "M4 dependency file escaped its declared root" + } [pscustomobject]@{ - Relative = [IO.Path]::GetRelativePath($Root, $file.FullName).Replace("\", "/") + Relative = $file.FullName.Substring($rootPrefix.Length).Replace("\", "/") File = $file } }