-
Notifications
You must be signed in to change notification settings - Fork 868
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
[BUG]: ProcessInvokerWrapper does not support Constrained Language Mode #4492
Comments
It looks like the arguments for this are call to powershell.exe are built in PowerShell3Handler.cs starting on line 49 (for the current master release), which is then used on a call to StepHone.ExecuteAsync passing this string as an argument. I propose either writing this set of commands to disk, and making the argument passed to powershell.exe the name of the file being referenced. Ideally this created script should be signed, but as long as it exists on disk on an identifiable path it can be whitelisted for WDAC / CLM enforcement. A better alternative would be a signed, parameterized PowerShell script that is designed to take the four arguments being passed to build this string. |
Hi @timbrigham-oc, thanks for reporting! |
@vmapetr, I think we can close this ticket. I've submitted a pull request to address this issue. |
It's been four months since I submitted this pull request and it hasn't been merged. Needs to be in the backlog. |
This issue has had no activity in 180 days. Please comment if it is not actually stale |
Closing since merged in pull request 4917. Thanks MS team! |
What happened?
While attempting to run any of the common tasks (script, powershell, powershell@2) the following error occurs on WDAC & CLM enabled devices. This makes using the Azure DevOps agent to test on endpoints hardened with this technology impossible. Please note that this is not a problem with a single task. I believe that this does not belong with the team at Azure-Pipelines-Tasks as a result. Using ProcMon while executing a pipeline shows definitively that Agent.Worker.exe is responsible for spawning a PowerShell instance with dynamic, unsigned code via the prompt instead of a script file.
The error received is the same for all tasks:
Cannot invoke method. Method invocation is supported only on core types in this language mode.
On analysis of the logs, the ProcessInvokerWrapper statement from the worker log shows that there is code being executed directly through a PowerShell prompt, included in the bug report.
Since this code is being executed from the PowerShell prompt and not a script file it isn't signable. Not signable dynamic code equals CLM. CLM in use results in "Method invocation is supported only on core types in this language mode."
The method invocation failure results in not being able to test real world hardened devices using a ADO pipeline.
Versions
This has been received on agents from version 2.1.x (historical device which is now decommissioned) until 3.227.2.
Occurs with any Windows operating system with WDAC and CLM enabled.
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Win 10, Win 11, Server 2019, Server 2022
Version controll system
git
Relevant log output
The text was updated successfully, but these errors were encountered: