mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Import module for execution policy
This commit is contained in:
parent
ad32a8d9be
commit
3e90c0abd1
1 changed files with 9 additions and 5 deletions
|
|
@ -258,11 +258,15 @@ export function validatePowerShellExecutionPolicy(shellExecutableName) {
|
|||
|
||||
try {
|
||||
// Security: Use literal command string, no interpolation
|
||||
const policy = execSync('-Command "Get-ExecutionPolicy"', {
|
||||
// Import the Security module first - works for both powershell.exe and pwsh.exe
|
||||
const policy = execSync(
|
||||
"Import-Module Microsoft.PowerShell.Security; Get-ExecutionPolicy",
|
||||
{
|
||||
encoding: "utf8",
|
||||
shell: shellExecutableName,
|
||||
timeout: 5000, // 5 second timeout
|
||||
}).trim();
|
||||
}
|
||||
).trim();
|
||||
|
||||
const acceptablePolicies = ["RemoteSigned", "Unrestricted", "Bypass"];
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue