mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Write warning when getting executionpolicy fails
This commit is contained in:
parent
8ea4463ac5
commit
87c5eddc9e
1 changed files with 5 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { ECOSYSTEM_JS, ECOSYSTEM_PY } from "../config/settings.js";
|
import { ECOSYSTEM_JS, ECOSYSTEM_PY } from "../config/settings.js";
|
||||||
import { safeSpawn } from "../utils/safeSpawn.js";
|
import { safeSpawn } from "../utils/safeSpawn.js";
|
||||||
|
import { ui } from "../environment/userInteraction.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} AikidoTool
|
* @typedef {Object} AikidoTool
|
||||||
|
|
@ -294,8 +295,10 @@ export async function validatePowerShellExecutionPolicy(shellExecutableName) {
|
||||||
isValid: acceptablePolicies.includes(policy),
|
isValid: acceptablePolicies.includes(policy),
|
||||||
policy: policy,
|
policy: policy,
|
||||||
};
|
};
|
||||||
} catch {
|
} catch (err) {
|
||||||
// If we can't check the policy, return false to be safe
|
ui.writeWarning(
|
||||||
|
`An error happened while trying to find the current executionpolicy in powershell: ${err}`,
|
||||||
|
);
|
||||||
return { isValid: false, policy: "Unknown" };
|
return { isValid: false, policy: "Unknown" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue