فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

security(a02): block staging root symlinks and junction redirects

davoodmehraban89 committed Oct 30, 2026 at 19:17 UTC d9f6106a699093ae9033e2127854ac4ec03bd4b2
1 file changed +9
scripts/a02-private-holoo-zip-staging.ps1
+9
@@ -111,6 +111,15 @@ try {
111 $current = $current.Parent
112 }
113 $null = [System.IO.Directory]::CreateDirectory($privateRoot)
114 + # A preexisting junction at our application/staging subfolder must not
115 + # redirect extracted private backup bytes outside the user's profile.
116 + $stagingParent = [System.IO.DirectoryInfo]::new($privateRoot)
117 + while ($null -ne $stagingParent) {
118 + if (($stagingParent.Attributes -band [System.IO.FileAttributes]::ReparsePoint) -ne 0) {
119 + throw 'A02_STAGING_ROOT_LINK_DISALLOWED'
120 + }
121 + $stagingParent = $stagingParent.Parent
122 + }
123 $uniqueName = 'stage_' + [System.Guid]::NewGuid().ToString('N')
124 $newDirectory = [System.IO.Path]::Combine($privateRoot, $uniqueName)
125 $null = [System.IO.Directory]::CreateDirectory($newDirectory)