@@ -14111,7 +14111,7 @@ var __webpack_exports__ = {};
1411114111__nccwpck_require__.r(__webpack_exports__);
1411214112
1411314113// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
14114- var core = __nccwpck_require__(2186);
14114+ var lib_core = __nccwpck_require__(2186);
1411514115// EXTERNAL MODULE: external "child_process"
1411614116var external_child_process_ = __nccwpck_require__(3129);
1411714117// EXTERNAL MODULE: external "fs"
@@ -14135,10 +14135,34 @@ const stringify = dist.stringify;
1413514135const parse = dist.parse;
1413614136
1413714137;// CONCATENATED MODULE: ./src/common.ts
14138+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
14139+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14140+ return new (P || (P = Promise))(function (resolve, reject) {
14141+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14142+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14143+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14144+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14145+ });
14146+ };
14147+
1413814148function printInfo(web_url) {
1413914149 console.log("\x1b[32m%s\x1b[0m", "View security insights and recommended policy at:");
1414014150 console.log(`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`);
1414114151}
14152+ function addSummary() {
14153+ return __awaiter(this, void 0, void 0, function* () {
14154+ if (process.env.STATE_monitorStatusCode === "200") {
14155+ const web_url = "https://app.stepsecurity.io";
14156+ const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
14157+ yield core.summary
14158+ .addSeparator()
14159+ .addImage("https://github.com/step-security/harden-runner/raw/main/images/banner.png", "StepSecurity Harden-Runner", { width: "200" })
14160+ .addLink("View security insights and recommended policy", insights_url)
14161+ .addSeparator()
14162+ .write();
14163+ }
14164+ });
14165+ }
1414214166const 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.";
1414314167const 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.";
1414414168
@@ -14157,9 +14181,9 @@ function verifyChecksum(downloadPath) {
1415714181 .digest("hex"); // checksum of downloaded file
1415814182 const expectedChecksum = "79f397360470d6e42c73d6c9c5cf485ac9982e56e3e3fdd07f66c59cda4388c8"; // checksum for v0.12.1
1415914183 if (checksum !== expectedChecksum) {
14160- core .setFailed(`Checksum verification failed, expected ${expectedChecksum} instead got ${checksum}`);
14184+ lib_core .setFailed(`Checksum verification failed, expected ${expectedChecksum} instead got ${checksum}`);
1416114185 }
14162- core .debug("Checksum verification passed.");
14186+ lib_core .debug("Checksum verification passed.");
1416314187}
1416414188
1416514189;// CONCATENATED MODULE: external "node:fs"
@@ -14197,10 +14221,12 @@ function isDocker() {
1419714221
1419814222// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
1419914223var github = __nccwpck_require__(5438);
14224+ // EXTERNAL MODULE: external "os"
14225+ var external_os_ = __nccwpck_require__(2087);
1420014226// EXTERNAL MODULE: ./node_modules/@actions/http-client/lib/auth.js
1420114227var auth = __nccwpck_require__(5526);
1420214228;// CONCATENATED MODULE: ./src/cache.ts
14203- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
14229+ var cache_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1420414230 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1420514231 return new (P || (P = Promise))(function (resolve, reject) {
1420614232 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -14222,7 +14248,7 @@ function getCacheApiUrl(resource) {
1422214248 throw new Error("Cache Service Url not found, unable to restore cache.");
1422314249 }
1422414250 const url = `${baseUrl}_apis/artifactcache/${resource}`;
14225- core .debug(`Resource Url: ${url}`);
14251+ lib_core .debug(`Resource Url: ${url}`);
1422614252 return url;
1422714253}
1422814254function createAcceptHeader(type, apiVersion) {
@@ -14252,7 +14278,7 @@ function getCacheVersion(paths, compressionMethod) {
1425214278 return external_crypto_.createHash("sha256").update(components.join("|")).digest("hex");
1425314279}
1425414280function getCacheEntry(keys, paths, options) {
14255- return __awaiter (this, void 0, void 0, function* () {
14281+ return cache_awaiter (this, void 0, void 0, function* () {
1425614282 const httpClient = createHttpClient();
1425714283 const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
1425814284 const resource = `cache?keys=${encodeURIComponent(keys.join(","))}&version=${version}`;
@@ -14313,6 +14339,7 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1431314339
1431414340
1431514341
14342+
1431614343(() => setup_awaiter(void 0, void 0, void 0, function* () {
1431714344 try {
1431814345 if (process.platform !== "linux") {
@@ -14334,11 +14361,11 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1433414361 correlation_id: correlation_id,
1433514362 working_directory: process.env["GITHUB_WORKSPACE"],
1433614363 api_url: api_url,
14337- allowed_endpoints: core .getInput("allowed-endpoints"),
14338- egress_policy: core .getInput("egress-policy"),
14339- disable_telemetry: core .getBooleanInput("disable-telemetry"),
14340- disable_sudo: core .getBooleanInput("disable-sudo"),
14341- disable_file_monitoring: core .getBooleanInput("disable-file-monitoring"),
14364+ allowed_endpoints: lib_core .getInput("allowed-endpoints"),
14365+ egress_policy: lib_core .getInput("egress-policy"),
14366+ disable_telemetry: lib_core .getBooleanInput("disable-telemetry"),
14367+ disable_sudo: lib_core .getBooleanInput("disable-sudo"),
14368+ disable_file_monitoring: lib_core .getBooleanInput("disable-file-monitoring"),
1434214369 private: github.context.payload.repository.private,
1434314370 };
1434414371 if (isValidEvent()) {
@@ -14347,32 +14374,37 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1434714374 compressionMethod: CompressionMethod.ZstdWithoutLong,
1434814375 });
1434914376 const url = new URL(cacheEntry.archiveLocation);
14350- core .info(`Adding cacheHost: ${url.hostname}:443 to allowed-endpoints`);
14377+ lib_core .info(`Adding cacheHost: ${url.hostname}:443 to allowed-endpoints`);
1435114378 confg.allowed_endpoints += ` ${url.hostname}:443`;
1435214379 }
1435314380 catch (exception) {
1435414381 // some exception has occurred.
14355- core .info("Unable to fetch cacheURL");
14382+ lib_core .info("Unable to fetch cacheURL");
1435614383 if (confg.egress_policy === "block") {
14357- core .info("Switching egress-policy to audit mode");
14384+ lib_core .info("Switching egress-policy to audit mode");
1435814385 confg.egress_policy = "audit";
1435914386 }
1436014387 }
1436114388 }
1436214389 if (confg.egress_policy !== "audit" && confg.egress_policy !== "block") {
14363- core .setFailed("egress-policy must be either audit or block");
14390+ lib_core .setFailed("egress-policy must be either audit or block");
1436414391 }
1436514392 if (confg.egress_policy === "block" && confg.allowed_endpoints === "") {
14366- core .warning("egress-policy is set to block (default) and allowed-endpoints is empty. No outbound traffic will be allowed for job steps.");
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.");
1436714394 }
1436814395 if (confg.disable_telemetry !== true && confg.disable_telemetry !== false) {
14369- core .setFailed("disable-telemetry must be a boolean value");
14396+ lib_core .setFailed("disable-telemetry must be a boolean value");
1437014397 }
1437114398 if (!confg.disable_telemetry) {
1437214399 let _http = new lib.HttpClient();
1437314400 _http.requestOptions = { socketTimeout: 3 * 1000 };
1437414401 try {
14375- yield _http.get(`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`);
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+ }
1437614408 }
1437714409 catch (e) {
1437814410 console.log(`error in connecting to ${api_url}: ${e}`);
@@ -14382,7 +14414,7 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1438214414 external_child_process_.execSync("sudo mkdir -p /home/agent");
1438314415 external_child_process_.execSync("sudo chown -R $USER /home/agent");
1438414416 // Note: to avoid github rate limiting
14385- let token = core .getInput("token");
14417+ let token = lib_core .getInput("token");
1438614418 let auth = `token ${token}`;
1438714419 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);
1438814420 verifyChecksum(downloadPath); // NOTE: verifying agent's checksum, before extracting
@@ -14429,7 +14461,7 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
1442914461 }
1443014462 }
1443114463 catch (error) {
14432- core .setFailed(error.message);
14464+ lib_core .setFailed(error.message);
1443314465 }
1443414466}))();
1443514467function sleep(ms) {
0 commit comments