Skip to content

Commit c8454ef

Browse files
Release v2.2.0 (#245)
1 parent 8f144f8 commit c8454ef

File tree

12 files changed

+113
-74
lines changed

12 files changed

+113
-74
lines changed

dist/index.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61033,8 +61033,10 @@ function addSummary() {
6103361033
}
6103461034
});
6103561035
}
61036+
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
6103661037
const CONTAINER_MESSAGE = "This job is running in a container. Harden Runner does not run in a container as it needs sudo access to run. This job will not be monitored.";
6103761038
const UBUNTU_MESSAGE = "This job is not running in a GitHub Actions Hosted Runner Ubuntu VM. Harden Runner is only supported on Ubuntu VM. This job will not be monitored.";
61039+
const HARDEN_RUNNER_UNAVAILABLE_MESSAGE = "Sorry, we are currently experiencing issues with the Harden Runner installation process. It is currently unavailable.";
6103861040

6103961041
;// CONCATENATED MODULE: external "node:fs"
6104061042
const external_node_fs_namespaceObject = require("node:fs");
@@ -61199,6 +61201,11 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6119961201
console.log(CONTAINER_MESSAGE);
6120061202
return;
6120161203
}
61204+
if (String(process.env.STATE_monitorStatusCode) ===
61205+
STATUS_HARDEN_RUNNER_UNAVAILABLE) {
61206+
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
61207+
return;
61208+
}
6120261209
external_fs_.writeFileSync("/home/agent/post_event.json", JSON.stringify({ event: "post" }));
6120361210
var doneFile = "/home/agent/done.json";
6120461211
var counter = 0;

dist/post/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pre/index.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14163,8 +14163,10 @@ function addSummary() {
1416314163
}
1416414164
});
1416514165
}
14166+
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
1416614167
const CONTAINER_MESSAGE = "This job is running in a container. Harden Runner does not run in a container as it needs sudo access to run. This job will not be monitored.";
1416714168
const UBUNTU_MESSAGE = "This job is not running in a GitHub Actions Hosted Runner Ubuntu VM. Harden Runner is only supported on Ubuntu VM. This job will not be monitored.";
14169+
const HARDEN_RUNNER_UNAVAILABLE_MESSAGE = "Sorry, we are currently experiencing issues with the Harden Runner installation process. It is currently unavailable.";
1416814170

1416914171
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
1417014172
var tool_cache = __nccwpck_require__(7784);
@@ -14179,7 +14181,7 @@ function verifyChecksum(downloadPath) {
1417914181
const checksum = external_crypto_.createHash("sha256")
1418014182
.update(fileBuffer)
1418114183
.digest("hex"); // checksum of downloaded file
14182-
const expectedChecksum = "79f397360470d6e42c73d6c9c5cf485ac9982e56e3e3fdd07f66c59cda4388c8"; // checksum for v0.12.1
14184+
const expectedChecksum = "10fd5587cfeba6aac4125be78ee32f60d5e780de10929f454525670c4c16935d"; // checksum for v0.12.2
1418314185
if (checksum !== expectedChecksum) {
1418414186
lib_core.setFailed(`Checksum verification failed, expected ${expectedChecksum} instead got ${checksum}`);
1418514187
}
@@ -14354,7 +14356,6 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1435414356
var env = "agent";
1435514357
var api_url = `https://${env}.api.stepsecurity.io/v1`;
1435614358
var web_url = "https://app.stepsecurity.io";
14357-
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
1435814359
const confg = {
1435914360
repo: process.env["GITHUB_REPOSITORY"],
1436014361
run_id: process.env["GITHUB_RUN_ID"],
@@ -14368,6 +14369,33 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1436814369
disable_file_monitoring: lib_core.getBooleanInput("disable-file-monitoring"),
1436914370
private: github.context.payload.repository.private,
1437014371
};
14372+
if (confg.egress_policy !== "audit" && confg.egress_policy !== "block") {
14373+
lib_core.setFailed("egress-policy must be either audit or block");
14374+
}
14375+
if (confg.egress_policy === "block" && confg.allowed_endpoints === "") {
14376+
lib_core.warning("egress-policy is set to block (default) and allowed-endpoints is empty. No outbound traffic will be allowed for job steps.");
14377+
}
14378+
if (confg.disable_telemetry !== true && confg.disable_telemetry !== false) {
14379+
lib_core.setFailed("disable-telemetry must be a boolean value");
14380+
}
14381+
let _http = new lib.HttpClient();
14382+
let statusCode;
14383+
_http.requestOptions = { socketTimeout: 3 * 1000 };
14384+
try {
14385+
const resp = yield _http.get(`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`);
14386+
statusCode = resp.message.statusCode; // adding error code to check whether agent is getting installed or not.
14387+
external_fs_.appendFileSync(process.env.GITHUB_STATE, `monitorStatusCode=${statusCode}${external_os_.EOL}`, {
14388+
encoding: "utf8",
14389+
});
14390+
}
14391+
catch (e) {
14392+
console.log(`error in connecting to ${api_url}: ${e}`);
14393+
}
14394+
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
14395+
if (String(statusCode) === STATUS_HARDEN_RUNNER_UNAVAILABLE) {
14396+
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
14397+
return;
14398+
}
1437114399
if (isValidEvent()) {
1437214400
try {
1437314401
const cacheEntry = yield getCacheEntry([cacheKey], [cacheFile], {
@@ -14386,37 +14414,13 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1438614414
}
1438714415
}
1438814416
}
14389-
if (confg.egress_policy !== "audit" && confg.egress_policy !== "block") {
14390-
lib_core.setFailed("egress-policy must be either audit or block");
14391-
}
14392-
if (confg.egress_policy === "block" && confg.allowed_endpoints === "") {
14393-
lib_core.warning("egress-policy is set to block (default) and allowed-endpoints is empty. No outbound traffic will be allowed for job steps.");
14394-
}
14395-
if (confg.disable_telemetry !== true && confg.disable_telemetry !== false) {
14396-
lib_core.setFailed("disable-telemetry must be a boolean value");
14397-
}
14398-
if (!confg.disable_telemetry) {
14399-
let _http = new lib.HttpClient();
14400-
_http.requestOptions = { socketTimeout: 3 * 1000 };
14401-
try {
14402-
const resp = yield _http.get(`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`);
14403-
if (resp.message.statusCode === 200) {
14404-
external_fs_.appendFileSync(process.env.GITHUB_STATE, `monitorStatusCode=${resp.message.statusCode}${external_os_.EOL}`, {
14405-
encoding: "utf8",
14406-
});
14407-
}
14408-
}
14409-
catch (e) {
14410-
console.log(`error in connecting to ${api_url}: ${e}`);
14411-
}
14412-
}
1441314417
const confgStr = JSON.stringify(confg);
1441414418
external_child_process_.execSync("sudo mkdir -p /home/agent");
1441514419
external_child_process_.execSync("sudo chown -R $USER /home/agent");
1441614420
// Note: to avoid github rate limiting
1441714421
let token = lib_core.getInput("token");
1441814422
let auth = `token ${token}`;
14419-
const downloadPath = yield tool_cache.downloadTool("https://github.com/step-security/agent/releases/download/v0.12.1/agent_0.12.1_linux_amd64.tar.gz", undefined, auth);
14423+
const downloadPath = yield tool_cache.downloadTool("https://github.com/step-security/agent/releases/download/v0.12.2/agent_0.12.2_linux_amd64.tar.gz", undefined, auth);
1442014424
verifyChecksum(downloadPath); // NOTE: verifying agent's checksum, before extracting
1442114425
const extractPath = yield tool_cache.extractTar(downloadPath);
1442214426
if (!confg.disable_telemetry || confg.egress_policy === "audit") {

dist/pre/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "step-security-harden-runner",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Security agent for GitHub-hosted runner to monitor the build process",
55
"main": "index.js",
66
"scripts": {

src/checksum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function verifyChecksum(downloadPath: string) {
1010
.digest("hex"); // checksum of downloaded file
1111

1212
const expectedChecksum: string =
13-
"79f397360470d6e42c73d6c9c5cf485ac9982e56e3e3fdd07f66c59cda4388c8"; // checksum for v0.12.1
13+
"10fd5587cfeba6aac4125be78ee32f60d5e780de10929f454525670c4c16935d"; // checksum for v0.12.2
1414

1515
if (checksum !== expectedChecksum) {
1616
core.setFailed(

src/cleanup.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ import path from "path";
1717
return;
1818
}
1919

20+
if (
21+
String(process.env.STATE_monitorStatusCode) ===
22+
common.STATUS_HARDEN_RUNNER_UNAVAILABLE
23+
) {
24+
console.log(common.HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
25+
return;
26+
}
27+
2028
fs.writeFileSync(
2129
"/home/agent/post_event.json",
2230
JSON.stringify({ event: "post" })

src/common.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ export async function addSummary() {
2121
"StepSecurity Harden-Runner",
2222
{ width: "200" }
2323
)
24-
.addLink(
25-
"View security insights and recommended policy",
26-
insights_url
27-
)
24+
.addLink("View security insights and recommended policy", insights_url)
2825
.addSeparator()
2926
.write();
3027
}
3128
}
29+
30+
export const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
31+
3232
export const CONTAINER_MESSAGE =
3333
"This job is running in a container. Harden Runner does not run in a container as it needs sudo access to run. This job will not be monitored.";
3434

3535
export const UBUNTU_MESSAGE =
3636
"This job is not running in a GitHub Actions Hosted Runner Ubuntu VM. Harden Runner is only supported on Ubuntu VM. This job will not be monitored.";
37+
38+
export const HARDEN_RUNNER_UNAVAILABLE_MESSAGE =
39+
"Sorry, we are currently experiencing issues with the Harden Runner installation process. It is currently unavailable.";

0 commit comments

Comments
 (0)