8000 [release/v7.4] Fallback to AppLocker after `WldpCanExecuteFile` by TravisEz13 · Pull Request #25229 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

[release/v7.4] Fallback to AppLocker after WldpCanExecuteFile #25229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

TravisEz13
Copy link
Member

Backport #24912

This pull request includes several changes to the src/System.Management.Automation/security/wldpNativeMethods.cs file to improve the handling of system lockdown policies and file policy enforcement. The changes primarily focus on refining the logic for determining enforcement modes and handling exceptions more effectively.

Key changes include:

Improvements to system lockdown policy handling:

  • Modified the GetSystemLockdownPolicy method to use an out parameter for GetDebugLockdownPolicy.
  • Added a new method ConvertToModernFileEnforcement to convert legacy enforcement modes to modern file enforcement modes.

Enhancements to file policy enforcement:

  • Updated the GetFilePolicyEnforcement method to use the new ConvertToModernFileEnforcement method and added logic to handle different enforcement scenarios more accurately.
  • Introduced the TryGetWldpCanExecuteFileResult method to handle the result of WldpCanExecuteFile and fallback to legacy APIs if necessary.

Exception handling improvements:

  • Refined the exception handling in GetFilePolicyEnforcement to catch both DllNotFoundException and EntryPointNotFoundException and log the appropriate events.

Additional minor changes:

  • Added System.Diagnostics using directive for better debugging support.
  • Adjusted the GetDebugLockdownPolicy method to use an out parameter for modern enforcement. [1] [2] [3]

These changes collectively enhance the robustness and accuracy of the system's lockdown policy and file enforcement mechanisms.

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
@TravisEz13 TravisEz13 self-assigned this Mar 24, 2025
@TravisEz13 TravisEz13 added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Mar 24, 2025
@TravisEz13
Copy link
Member Author

/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI

Copy link
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Collaborator
@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Apr 1, 2025
@TravisEz13 TravisEz13 merged commit 3e5477f into PowerShell:release/v7.4 Apr 4, 2025
34 of 35 checks passed
@TravisEz13 TravisEz13 deleted the backport-24912-749 branch April 4, 2025 22:11
Copy link
Contributor
microsoft-github-policy-service bot commented Apr 4, 2025

📣 Hey @@TravisEz13, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Apr 4, 2025
@jshigetomi jshigetomi mentioned this pull request May 6, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-Engine Indicates that a PR should be marked as an engine change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0