boolean (@NotNull Project project, @NotNull List<Path> paths) { logCaller("paths=" + paths); try { var script = PathManager.findBinFile(HELPER_SCRIPT_NAME); if (script == null) { LOG.info("'" + HELPER_SCRIPT_NAME + "' is missing from '" + PathManager.getBinPath() + "'"); return false; } var psh = PathEnvironmentVariableUtil.findInPath("powershell.exe"); if (psh == null) { LOG.info("no 'powershell.exe' on " + PathEnvironmentVariableUtil.getPathVariableValue()); return false; } var sane = Stream.of("SystemRoot", "ProgramFiles").map(System::getenv).anyMatch(val -> val != null && psh.toPath().startsWith(val)); if (!sane) { LOG.info("suspicious 'powershell.exe' location: " + psh); return false; } var scriptlet = "(Get-AuthenticodeSignature '" + script + "').Status"; var command = new GeneralCommandLine(psh.getPath(), "-NoProfile", "-NonInteractive", "-Command", scriptlet); var output = run(command); if (output.getExitCode() != 0) { LOG.info("validation failed:\n[" + output.getExitCode() + "] " + command + "\noutput: " + output.getStdout().trim()); return false; } var status = output.getStdout().trim(); if ("NotSigned".equals(status) && ApplicationInfo.getInstance().getBuild().isSnapshot()) { LOG.info("allowing unsigned helper in dev. build " + ApplicationInfo.getInstance().getBuild()); } else if (!"Valid".equals(status)) { LOG.info("validation failed: status='" + status + "'"); return false; } command = ExecUtil.sudoCommand( new GeneralCommandLine(Stream.concat( Stream.of(psh.getPath(), "-ExecutionPolicy", "Bypass", "-NoProfile", "-NonInteractive", "-File", script.toString()), paths.stream().map(Path::toString) ).toList()), "" ).withCharset(StandardCharsets.UTF_8); output = run(command); if (output.getExitCode() != 0) { LOG.info("script failed:\n[" + output.getExitCode() + "] " + command + "\noutput: " + output.getStdout().trim()); return false; } else { LOG.info("OK; script output:\n" + output.getStdout().trim()); PropertiesComponent.getInstance(project).setValue(IGNORE_STATUS_CHECK, true); return true; } } catch (Exception e) { LOG.warn(e); return false; } }