Mark of the Web unblock when loading dependencies#1335
Open
rberghuis wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a Windows-specific mitigation for the 0x80131515 dependency load failure caused by Mark of the Web (Zone.Identifier ADS) when dependencies are downloaded and later loaded via Windows PowerShell compatibility (-UseWindowsPowerShell).
Changes:
- Detect files under the saved dependency module folder that have an Internet/Restricted Zone.Identifier and run
Unblock-Fileon them (Windows only).
Comment on lines
+217
to
+221
| # Unblock files downloaded from the internet so WinPS5 implicit remoting can load their DLLs. | ||
| # Downloaded files carry a Zone.Identifier ADS mark that causes 0x80131515 when .NET tries to load them. | ||
| if ($IsWindows) { | ||
| $savedModulePath = Join-Path -Path $RequiredModulesPath -ChildPath $moduleSpec.Name | ||
| if (Test-Path -Path $savedModulePath) { |
Copilot provided improvement that reduces IO load by only unlocking DLL files Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+222
to
+224
| Get-ChildItem -Path $savedModulePath -Recurse -File -Filter '*.dll' -ErrorAction SilentlyContinue | Where-Object { | ||
| (Get-Item -LiteralPath $_.FullName -Stream Zone.Identifier -ErrorAction SilentlyContinue) -and ((Get-Content -LiteralPath $_.FullName -Stream Zone.Identifier -ErrorAction SilentlyContinue) -match 'ZoneId\s*=\s*(3|4)\b') | ||
| } | Unblock-File -ErrorAction SilentlyContinue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0x80131515 is the result of Windows Mark of the Web (Zone.Identifier) block. During dependency loading, confirm if MotW would block load and unblock if applicable. Resolves issue #1330