mirror of
https://github.com/step-security/harden-runner.git
synced 2026-06-07 16:47:07 +00:00
addressed comments
This commit is contained in:
parent
ac1419447b
commit
6061152f29
10 changed files with 33 additions and 31 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
|
@ -34421,11 +34421,11 @@ function isAgentInstalled(platform) {
|
|||
function utils_getAnnotationLogs(platform) {
|
||||
switch (platform) {
|
||||
case "linux":
|
||||
return fs.readFileSync("/home/agent/annotation.log");
|
||||
return fs.readFileSync("/home/agent/annotation.log", "utf8");
|
||||
case "win32":
|
||||
return fs.readFileSync("C:\\agent\\annotation.log");
|
||||
return fs.readFileSync("C:\\agent\\annotation.log", "utf8");
|
||||
case "darwin":
|
||||
return fs.readFileSync("/opt/step-security/annotation.log");
|
||||
return fs.readFileSync("/opt/step-security/annotation.log", "utf8");
|
||||
default:
|
||||
throw new Error("platform not supported");
|
||||
}
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
8
dist/post/index.js
vendored
8
dist/post/index.js
vendored
|
|
@ -34421,11 +34421,11 @@ function isAgentInstalled(platform) {
|
|||
function getAnnotationLogs(platform) {
|
||||
switch (platform) {
|
||||
case "linux":
|
||||
return external_fs_.readFileSync("/home/agent/annotation.log");
|
||||
return external_fs_.readFileSync("/home/agent/annotation.log", "utf8");
|
||||
case "win32":
|
||||
return external_fs_.readFileSync("C:\\agent\\annotation.log");
|
||||
return external_fs_.readFileSync("C:\\agent\\annotation.log", "utf8");
|
||||
case "darwin":
|
||||
return external_fs_.readFileSync("/opt/step-security/annotation.log");
|
||||
return external_fs_.readFileSync("/opt/step-security/annotation.log", "utf8");
|
||||
default:
|
||||
throw new Error("platform not supported");
|
||||
}
|
||||
|
|
@ -34817,7 +34817,7 @@ function handleMacosCleanup() {
|
|||
}
|
||||
let macAgentLog = "/opt/step-security/agent.log";
|
||||
if (external_fs_.existsSync(macAgentLog)) {
|
||||
console.log("macAgenLog:");
|
||||
console.log("macAgentLog:");
|
||||
var content = external_fs_.readFileSync(macAgentLog, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
|
|
|
|||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
21
dist/pre/index.js
vendored
21
dist/pre/index.js
vendored
|
|
@ -87677,11 +87677,11 @@ function isAgentInstalled(platform) {
|
|||
function utils_getAnnotationLogs(platform) {
|
||||
switch (platform) {
|
||||
case "linux":
|
||||
return fs.readFileSync("/home/agent/annotation.log");
|
||||
return fs.readFileSync("/home/agent/annotation.log", "utf8");
|
||||
case "win32":
|
||||
return fs.readFileSync("C:\\agent\\annotation.log");
|
||||
return fs.readFileSync("C:\\agent\\annotation.log", "utf8");
|
||||
case "darwin":
|
||||
return fs.readFileSync("/opt/step-security/annotation.log");
|
||||
return fs.readFileSync("/opt/step-security/annotation.log", "utf8");
|
||||
default:
|
||||
throw new Error("platform not supported");
|
||||
}
|
||||
|
|
@ -88125,7 +88125,7 @@ function installAgent(isTLS, configStr) {
|
|||
return true;
|
||||
});
|
||||
}
|
||||
function installMacosAgent(confgStr) {
|
||||
function installMacosAgent(configStr) {
|
||||
return install_agent_awaiter(this, void 0, void 0, function* () {
|
||||
const token = lib_core.getInput("token", { required: true });
|
||||
const auth = `token ${token}`;
|
||||
|
|
@ -88137,7 +88137,7 @@ function installMacosAgent(confgStr) {
|
|||
lib_core.info("✓ Successfully created /opt/step-security directory");
|
||||
// Create agent configuration file
|
||||
lib_core.info("Creating agent.json");
|
||||
external_fs_.writeFileSync("/opt/step-security/agent.json", confgStr);
|
||||
external_fs_.writeFileSync("/opt/step-security/agent.json", configStr);
|
||||
lib_core.info("✓ Successfully created agent.json at /opt/step-security/agent.json");
|
||||
// Download installer package
|
||||
const downloadUrl = "https://github.com/step-security/agent-releases/releases/download/v1.0.0-int/macos-installer-0.0.1.tar.gz";
|
||||
|
|
@ -88233,7 +88233,8 @@ function installWindowsAgent(configStr) {
|
|||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
lib_core.setFailed(`Failed to start Windows agent process: ${error.message}`);
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
lib_core.setFailed(`Failed to start Windows agent process: ${errorMessage}`);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
@ -88482,7 +88483,7 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
|
|||
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
const confgStr = JSON.stringify(confg);
|
||||
const configStr = JSON.stringify(confg);
|
||||
// platform specific
|
||||
let statusFile = "";
|
||||
let logFile = "";
|
||||
|
|
@ -88494,17 +88495,17 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
|
|||
external_child_process_.execSync("sudo mkdir -p /home/agent");
|
||||
chownForFolder(process.env.USER, "/home/agent");
|
||||
let isTLS = yield isTLSEnabled(github.context.repo.owner);
|
||||
agentInstalled = yield installAgent(isTLS, confgStr);
|
||||
agentInstalled = yield installAgent(isTLS, configStr);
|
||||
break;
|
||||
case "win32":
|
||||
lib_core.info("Installing Windows Agent...");
|
||||
agentInstalled = yield installWindowsAgent(confgStr);
|
||||
agentInstalled = yield installWindowsAgent(configStr);
|
||||
const agentDir = process.env.STATE_agentDir || "C:\\agent";
|
||||
statusFile = external_path_.join(agentDir, "agent.status");
|
||||
logFile = external_path_.join(agentDir, "agent.log");
|
||||
break;
|
||||
case "darwin":
|
||||
const installed = yield installMacosAgent(confgStr);
|
||||
const installed = yield installMacosAgent(configStr);
|
||||
if (!installed) {
|
||||
lib_core.warning("😭 macos agent installation failed");
|
||||
}
|
||||
|
|
|
|||
2
dist/pre/index.js.map
vendored
2
dist/pre/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -167,7 +167,7 @@ async function handleMacosCleanup() {
|
|||
|
||||
let macAgentLog = "/opt/step-security/agent.log";
|
||||
if (fs.existsSync(macAgentLog)) {
|
||||
console.log("macAgenLog:");
|
||||
console.log("macAgentLog:");
|
||||
var content = fs.readFileSync(macAgentLog, "utf-8");
|
||||
console.log(content);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export async function installAgent(
|
|||
return true;
|
||||
}
|
||||
|
||||
export async function installMacosAgent(confgStr: string): Promise<boolean> {
|
||||
export async function installMacosAgent(configStr: string): Promise<boolean> {
|
||||
const token = core.getInput("token", { required: true });
|
||||
const auth = `token ${token}`;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ export async function installMacosAgent(confgStr: string): Promise<boolean> {
|
|||
|
||||
// Create agent configuration file
|
||||
core.info("Creating agent.json");
|
||||
fs.writeFileSync("/opt/step-security/agent.json", confgStr);
|
||||
fs.writeFileSync("/opt/step-security/agent.json", configStr);
|
||||
core.info(
|
||||
"✓ Successfully created agent.json at /opt/step-security/agent.json"
|
||||
);
|
||||
|
|
@ -208,7 +208,8 @@ export async function installWindowsAgent(configStr: string): Promise<boolean> {
|
|||
core.info("Windows Agent process started successfully");
|
||||
return true;
|
||||
} catch (error) {
|
||||
core.setFailed(`Failed to start Windows agent process: ${error.message}`);
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
core.setFailed(`Failed to start Windows agent process: ${errorMessage}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ interface MonitorResponse {
|
|||
return;
|
||||
}
|
||||
|
||||
const confgStr = JSON.stringify(confg);
|
||||
const configStr = JSON.stringify(confg);
|
||||
|
||||
// platform specific
|
||||
let statusFile = "";
|
||||
|
|
@ -343,12 +343,12 @@ interface MonitorResponse {
|
|||
chownForFolder(process.env.USER, "/home/agent");
|
||||
|
||||
let isTLS = await isTLSEnabled(context.repo.owner);
|
||||
agentInstalled = await installAgent(isTLS, confgStr);
|
||||
agentInstalled = await installAgent(isTLS, configStr);
|
||||
|
||||
break;
|
||||
case "win32":
|
||||
core.info("Installing Windows Agent...");
|
||||
agentInstalled = await installWindowsAgent(confgStr);
|
||||
agentInstalled = await installWindowsAgent(configStr);
|
||||
|
||||
const agentDir = process.env.STATE_agentDir || "C:\\agent";
|
||||
statusFile = path.join(agentDir, "agent.status");
|
||||
|
|
@ -356,7 +356,7 @@ interface MonitorResponse {
|
|||
|
||||
break;
|
||||
case "darwin":
|
||||
const installed = await installMacosAgent(confgStr);
|
||||
const installed = await installMacosAgent(configStr);
|
||||
if (!installed) {
|
||||
core.warning("😭 macos agent installation failed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ export function isAgentInstalled(platform: NodeJS.Platform) {
|
|||
export function getAnnotationLogs(platform: NodeJS.Platform) {
|
||||
switch (platform) {
|
||||
case "linux":
|
||||
return fs.readFileSync("/home/agent/annotation.log");
|
||||
return fs.readFileSync("/home/agent/annotation.log", "utf8");
|
||||
case "win32":
|
||||
return fs.readFileSync("C:\\agent\\annotation.log");
|
||||
return fs.readFileSync("C:\\agent\\annotation.log", "utf8");
|
||||
case "darwin":
|
||||
return fs.readFileSync("/opt/step-security/annotation.log");
|
||||
return fs.readFileSync("/opt/step-security/annotation.log", "utf8");
|
||||
default:
|
||||
throw new Error("platform not supported");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue