mirror of
https://github.com/step-security/harden-runner.git
synced 2026-06-05 19:53:33 +00:00
resolve review comments
This commit is contained in:
parent
a092fc63bd
commit
35cc9f998f
7 changed files with 35 additions and 33 deletions
18
dist/post/index.js
vendored
18
dist/post/index.js
vendored
|
|
@ -32197,26 +32197,26 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
|
|||
const log = "/home/agent/agent.log";
|
||||
if (external_fs_.existsSync(log)) {
|
||||
console.log("log:");
|
||||
var content = external_fs_.readFileSync(log, "utf-8");
|
||||
const content = external_fs_.readFileSync(log, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
const daemonLog = "/home/agent/daemon.log";
|
||||
if (external_fs_.existsSync(daemonLog)) {
|
||||
console.log("daemonLog:");
|
||||
var content = external_fs_.readFileSync(daemonLog, "utf-8");
|
||||
const content = external_fs_.readFileSync(daemonLog, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
var status = "/home/agent/agent.status";
|
||||
const status = "/home/agent/agent.status";
|
||||
if (external_fs_.existsSync(status)) {
|
||||
console.log("status:");
|
||||
var content = external_fs_.readFileSync(status, "utf-8");
|
||||
const content = external_fs_.readFileSync(status, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
var disable_sudo = process.env.STATE_disableSudo;
|
||||
var disable_sudo_and_containers = process.env.STATE_disableSudoAndContainers;
|
||||
const disable_sudo = process.env.STATE_disableSudo;
|
||||
const disable_sudo_and_containers = process.env.STATE_disableSudoAndContainers;
|
||||
if (disable_sudo !== "true" && disable_sudo_and_containers !== "true") {
|
||||
try {
|
||||
var journalLog = external_child_process_.execSync("sudo journalctl -u agent.service --lines=1000", {
|
||||
const journalLog = external_child_process_.execSync("sudo journalctl -u agent.service --lines=1000", {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 1024 * 1024 * 10, // 10MB buffer
|
||||
});
|
||||
|
|
@ -32233,7 +32233,7 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
|
|||
const agentDir = process.env.STATE_agentDir || "C:\\agent";
|
||||
const postEventFile = external_path_.join(agentDir, "post_event.json");
|
||||
if (isGithubHosted() && external_fs_.existsSync(postEventFile)) {
|
||||
console.log("windows post step already executed, skipping");
|
||||
console.log("Windows post step already executed, skipping");
|
||||
return;
|
||||
}
|
||||
const p = external_child_process_.spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", "query user; exit $LASTEXITCODE"], { stdio: ["ignore", "pipe", "pipe"], shell: false, windowsHide: true });
|
||||
|
|
@ -32301,7 +32301,7 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
|
|||
const log = external_path_.join(agentDir, "agent.log");
|
||||
if (external_fs_.existsSync(log)) {
|
||||
console.log("agent log:");
|
||||
var content = external_fs_.readFileSync(log, "utf-8");
|
||||
const content = external_fs_.readFileSync(log, "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
5
dist/pre/index.js
vendored
5
dist/pre/index.js
vendored
|
|
@ -85521,6 +85521,8 @@ function verifyChecksum(downloadPath, isTLS, variant, platform) {
|
|||
case "win32":
|
||||
expectedChecksum = CHECKSUMS["windows"][variant];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
if (checksum !== expectedChecksum) {
|
||||
lib_core.setFailed(`Checksum verification failed, expected ${expectedChecksum} instead got ${checksum}`);
|
||||
|
|
@ -85616,8 +85618,7 @@ function installWindowsAgent(configStr) {
|
|||
const logPath = external_path_.join(agentDir, "agent.log");
|
||||
const logStream = external_fs_.openSync(logPath, 'a');
|
||||
lib_core.info(`Agent logs will be written to: ${logPath}`);
|
||||
const { spawn } = __nccwpck_require__(5317);
|
||||
const agentProcess = spawn(agentExePath, [], {
|
||||
const agentProcess = external_child_process_.spawn(agentExePath, [], {
|
||||
cwd: agentDir,
|
||||
detached: true,
|
||||
stdio: ['ignore', logStream, logStream],
|
||||
|
|
|
|||
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
|
|
@ -30,15 +30,17 @@ export function verifyChecksum(
|
|||
let expectedChecksum: string = "";
|
||||
|
||||
switch (platform) {
|
||||
case "linux":
|
||||
expectedChecksum = isTLS
|
||||
? CHECKSUMS["tls"][variant]
|
||||
: CHECKSUMS["non_tls"][variant];
|
||||
break;
|
||||
case "win32":
|
||||
expectedChecksum = CHECKSUMS["windows"][variant];
|
||||
break;
|
||||
}
|
||||
case "linux":
|
||||
expectedChecksum = isTLS
|
||||
? CHECKSUMS["tls"][variant]
|
||||
: CHECKSUMS["non_tls"][variant];
|
||||
break;
|
||||
case "win32":
|
||||
expectedChecksum = CHECKSUMS["windows"][variant];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
|
||||
if (checksum !== expectedChecksum) {
|
||||
core.setFailed(
|
||||
|
|
|
|||
|
|
@ -82,30 +82,30 @@ import { context } from "@actions/github";
|
|||
const log = "/home/agent/agent.log";
|
||||
if (fs.existsSync(log)) {
|
||||
console.log("log:");
|
||||
var content = fs.readFileSync(log, "utf-8");
|
||||
const content = fs.readFileSync(log, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
|
||||
const daemonLog = "/home/agent/daemon.log";
|
||||
if (fs.existsSync(daemonLog)) {
|
||||
console.log("daemonLog:");
|
||||
var content = fs.readFileSync(daemonLog, "utf-8");
|
||||
const content = fs.readFileSync(daemonLog, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
|
||||
var status = "/home/agent/agent.status";
|
||||
const status = "/home/agent/agent.status";
|
||||
if (fs.existsSync(status)) {
|
||||
console.log("status:");
|
||||
var content = fs.readFileSync(status, "utf-8");
|
||||
const content = fs.readFileSync(status, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
|
||||
var disable_sudo = process.env.STATE_disableSudo;
|
||||
var disable_sudo_and_containers = process.env.STATE_disableSudoAndContainers;
|
||||
const disable_sudo = process.env.STATE_disableSudo;
|
||||
const disable_sudo_and_containers = process.env.STATE_disableSudoAndContainers;
|
||||
|
||||
if (disable_sudo !== "true" && disable_sudo_and_containers !== "true") {
|
||||
try {
|
||||
var journalLog = cp.execSync(
|
||||
const journalLog = cp.execSync(
|
||||
"sudo journalctl -u agent.service --lines=1000",
|
||||
{
|
||||
encoding: "utf8",
|
||||
|
|
@ -124,7 +124,7 @@ import { context } from "@actions/github";
|
|||
const postEventFile = path.join(agentDir, "post_event.json");
|
||||
|
||||
if (isGithubHosted() && fs.existsSync(postEventFile)) {
|
||||
console.log("windows post step already executed, skipping");
|
||||
console.log("Windows post step already executed, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ import { context } from "@actions/github";
|
|||
const log = path.join(agentDir, "agent.log");
|
||||
if (fs.existsSync(log)) {
|
||||
console.log("agent log:");
|
||||
var content = fs.readFileSync(log, "utf-8");
|
||||
const content = fs.readFileSync(log, "utf-8");
|
||||
console.log(content);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ export async function installWindowsAgent(
|
|||
const logStream = fs.openSync(logPath, 'a');
|
||||
core.info(`Agent logs will be written to: ${logPath}`);
|
||||
|
||||
const { spawn } = require('child_process');
|
||||
const agentProcess = spawn(agentExePath, [], {
|
||||
const agentProcess = cp.spawn(agentExePath, [], {
|
||||
cwd: agentDir,
|
||||
detached: true,
|
||||
stdio: ['ignore', logStream, logStream],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue