fix(plugins): satisfy install security lint

This commit is contained in:
Vincent Koc
2026-06-17 12:40:40 +08:00
parent 80c47ecb99
commit 81df1b239b
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -2623,8 +2623,8 @@ describe("installPluginFromNpmSpec", () => {
expect(result!.ok).toBe(false);
if (!result!.ok) {
expect(result!.code, result!.error).toBe(PLUGIN_INSTALL_ERROR_CODE.SECURITY_SCAN_BLOCKED);
expect(result!.error).toContain("npm installs are disabled by policy");
expect(result.code, result.error).toBe(PLUGIN_INSTALL_ERROR_CODE.SECURITY_SCAN_BLOCKED);
expect(result.error).toContain("npm installs are disabled by policy");
}
expect(vi.mocked(runCommandWithTimeout)).toHaveBeenCalledTimes(1);
expect(vi.mocked(runCommandWithTimeout).mock.calls[0]?.[0]).toEqual([
+3 -2
View File
@@ -1839,6 +1839,7 @@ function sourceFamilyForInstallPolicyKind(
case undefined:
return fallback;
}
return fallback;
}
type PreparedInstallTarget = {
@@ -3074,11 +3075,11 @@ export async function installPluginFromNpmPackArchive(
}
const packageName = packageNameResult.packageName;
const npmBaseDir = params.npmDir ? resolveUserPath(params.npmDir) : resolveDefaultPluginNpmDir();
const npmRoot = resolvePluginNpmProjectDir({
const npmProjectRoot = resolvePluginNpmProjectDir({
npmDir: npmBaseDir,
packageName,
});
const installRoot = resolveManagedNpmRootPackageDir(npmRoot, packageName);
const installRoot = resolveManagedNpmRootPackageDir(npmProjectRoot, packageName);
const effectiveMode = await resolveEffectiveInstallMode({
runtime,
requestedMode: mode,