mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Check powershell execution policy in setup function
This commit is contained in:
parent
c765438e63
commit
e9799e283f
5 changed files with 114 additions and 13 deletions
|
|
@ -2,6 +2,7 @@ import {
|
|||
addLineToFile,
|
||||
doesExecutableExistOnSystem,
|
||||
removeLinesMatchingPattern,
|
||||
validatePowerShellExecutionPolicy,
|
||||
} from "../helpers.js";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
|
|
@ -39,6 +40,16 @@ function teardown(tools) {
|
|||
}
|
||||
|
||||
function setup() {
|
||||
// Check execution policy
|
||||
const { isValid, policy } = validatePowerShellExecutionPolicy(executableName);
|
||||
if (!isValid) {
|
||||
throw new Error(
|
||||
`PowerShell execution policy is set to '${policy}', which prevents safe-chain from running. ` +
|
||||
`To fix this, open PowerShell as Administrator and run: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned. ` +
|
||||
`For more information, see: https://github.com/AikidoSec/safe-chain/blob/main/docs/troubleshooting.md#powershell-execution-policy-blocks-scripts-windows`
|
||||
);
|
||||
}
|
||||
|
||||
const startupFile = getStartupFile();
|
||||
|
||||
addLineToFile(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue