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 {
|
try {
|
||||||
// Security: Use literal command string, no interpolation
|
// 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
|
||||||
encoding: "utf8",
|
const policy = execSync(
|
||||||
shell: shellExecutableName,
|
"Import-Module Microsoft.PowerShell.Security; Get-ExecutionPolicy",
|
||||||
timeout: 5000, // 5 second timeout
|
{
|
||||||
}).trim();
|
encoding: "utf8",
|
||||||
|
shell: shellExecutableName,
|
||||||
|
timeout: 5000, // 5 second timeout
|
||||||
|
}
|
||||||
|
).trim();
|
||||||
|
|
||||||
const acceptablePolicies = ["RemoteSigned", "Unrestricted", "Bypass"];
|
const acceptablePolicies = ["RemoteSigned", "Unrestricted", "Bypass"];
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue