Skip to content

Commit cba0d00

Browse files
Release v2.5.0 (#325)
1 parent aa817ef commit cba0d00

24 files changed

+1017
-382
lines changed

.eslintrc.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"overrides": [
11+
{
12+
"env": {
13+
"node": true
14+
},
15+
"files": [
16+
".eslintrc.{js,cjs}"
17+
],
18+
"parserOptions": {
19+
"sourceType": "script"
20+
}
21+
}
22+
],
23+
"parser": "@typescript-eslint/parser",
24+
"parserOptions": {
25+
"ecmaVersion": "latest",
26+
"sourceType": "module"
27+
},
28+
"plugins": [
29+
"@typescript-eslint"
30+
],
31+
"rules": {
32+
}
33+
}

.github/workflows/canary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v1
2626
with:
27-
allowed-endpoints:
27+
allowed-endpoints:
2828
api.github.com:443
2929
github.com:443
3030

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This Action will scan dependency manifest files that change as part of a Pull Request,
44
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5-
# Once installed, if the workflow run is marked as required,
5+
# Once installed, if the workflow run is marked as required,
66
# PRs introducing known-vulnerable packages will be blocked from merging.
77
#
88
# Source repository: https://github.com/actions/dependency-review-action

.github/workflows/recurring-int-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
permissions:
88
contents: read
9-
9+
1010
jobs:
1111
int-tests:
1212
name: int tests

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
- uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845
2929
with:
30-
allowed-endpoints:
30+
allowed-endpoints:
3131
api.github.com:443
3232
github.com:443
3333

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ typings/
104104
.tern-port
105105

106106
# vscode files
107-
.vscode
107+
.vscode

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
exclude: ^dist/
12
repos:
23
- repo: https://github.com/gitleaks/gitleaks
34
rev: v8.16.3

dist/index.js

Lines changed: 10 additions & 13 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: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61193,10 +61193,10 @@ function addSummary() {
6119361193
}
6119461194
if (needsSubscription) {
6119561195
yield core.summary.addSeparator()
61196-
.addRaw(`<h2>GitHub Actions Runtime Security is disabled</h2>`);
61196+
.addRaw(`<h2>⚠️ Your GitHub Actions Runtime Security is currently disabled!</h2>`);
6119761197
yield core.summary.addRaw(`
61198-
<p>You are seeing this markdown since this workflow uses the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a> by StepSecurity in a private repository, but your organization has not signed up for a free trial or a paid subscription.</p>
61199-
<p>To start a free trial, install the <a href="https://github.com/apps/stepsecurity-actions-security">StepSecurity Actions Security GitHub App</a> or reach out to us via our <a href="https://www.stepsecurity.io/contact">contact form.</a></p>
61198+
<p>It appears that you're using the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a> by StepSecurity within a private repository. However, runtime security is not enabled as your organization hasn't signed up for a free trial or a paid subscription yet.</p>
61199+
<p>To enable runtime security, start a free trial today by installing the <a href="https://github.com/apps/stepsecurity-actions-security">StepSecurity Actions Security GitHub App</a>. For more information or assistance, feel free to reach out to us through our <a href="https://www.stepsecurity.io/contact">contact form</a>.</p>
6120061200
`)
6120161201
.addSeparator()
6120261202
.write();
@@ -61211,11 +61211,8 @@ function addSummary() {
6121161211
if (tableEntries.length === 0) {
6121261212
return;
6121361213
}
61214-
let insightsRow = `<tr>
61215-
<td colspan="3" align="center"><a href="${insights_url}">🛡️ Check out the full report and recommended policy at StepSecurity</a></td>
61216-
</tr>`;
61217-
yield core.summary.addSeparator().addRaw(`<h2><a href="${insights_url}">StepSecurity Report</a></h2>
61218-
<h3>GitHub Actions Runtime Security</h3>`);
61214+
const insightsRow = `<h4><a href="${insights_url}">View Full Runtime Security Report & Recommended Policy</a></h4>`;
61215+
yield core.summary.addSeparator().addRaw(`<h2>StepSecurity Report</h2>`);
6121961216
tableEntries.sort((a, b) => {
6122061217
if (a.status === "❌ Blocked" && b.status !== "❌ Blocked") {
6122161218
return -1;
@@ -61229,12 +61226,13 @@ function addSummary() {
6122961226
});
6123061227
tableEntries = tableEntries.slice(0, 3);
6123161228
yield core.summary.addRaw(`
61229+
<p>Preview of the network events that occurred on the GitHub-hosted runner during this workflow run.</p>
6123261230
<h3>🌐 Network Events</h3>
6123361231
<table>
6123461232
<thead>
6123561233
<tr>
6123661234
<th>Process</th>
61237-
<th>Endpoint</th>
61235+
<th>Destination</th>
6123861236
<th>Status</th>
6123961237
</tr>
6124061238
</thead>
@@ -61251,13 +61249,11 @@ function addSummary() {
6125161249
<td>...</td>
6125261250
<td>...</td>
6125361251
</tr>
61254-
${insightsRow}
6125561252
</tbody>
6125661253
</table>
61254+
${insightsRow}
6125761255
`);
61258-
yield core.summary.addSeparator()
61259-
.addRaw(`<blockquote>You are seeing this markdown since this workflow uses the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a>.
61260-
Harden-Runner is a security agent for GitHub-hosted runners to block egress traffic & detect code overwrite to prevent breaches.</blockquote>`)
61256+
yield core.summary.addRaw(`<p>Markdown generated by the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a></p>`)
6126161257
.addSeparator()
6126261258
.write();
6126361259
});
@@ -61266,6 +61262,7 @@ const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
6126661262
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.";
6126761263
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.";
6126861264
const HARDEN_RUNNER_UNAVAILABLE_MESSAGE = "Sorry, we are currently experiencing issues with the Harden Runner installation process. It is currently unavailable.";
61265+
const ARC_RUNNER_MESSAGE = "Workflow is currently being executed in ARC based runner";
6126961266

6127061267
;// CONCATENATED MODULE: external "node:fs"
6127161268
const external_node_fs_namespaceObject = require("node:fs");
@@ -61322,6 +61319,45 @@ function isValidEvent() {
6132261319
// EXTERNAL MODULE: external "path"
6132361320
var external_path_ = __nccwpck_require__(5622);
6132461321
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
61322+
;// CONCATENATED MODULE: ./src/arc-runner.ts
61323+
61324+
function isArcRunner() {
61325+
const runnerUserAgent = process.env["GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT"];
61326+
if (!runnerUserAgent) {
61327+
return false;
61328+
}
61329+
return runnerUserAgent.includes("actions-runner-controller/");
61330+
}
61331+
function getRunnerTempDir() {
61332+
const isTest = process.env["isTest"];
61333+
if (isTest === "1") {
61334+
return "/tmp";
61335+
}
61336+
return process.env["RUNNER_TEMP"] || "/tmp";
61337+
}
61338+
function sendAllowedEndpoints(endpoints) {
61339+
const allowedEndpoints = endpoints.split(" "); // endpoints are space separated
61340+
for (const endpoint of allowedEndpoints) {
61341+
if (endpoint) {
61342+
const encodedEndpoint = Buffer.from(endpoint).toString("base64");
61343+
cp.execSync(`echo "${endpoint}" > "${getRunnerTempDir()}/step_policy_endpoint_${encodedEndpoint}"`);
61344+
}
61345+
}
61346+
if (allowedEndpoints.length > 0) {
61347+
applyPolicy(allowedEndpoints.length);
61348+
}
61349+
}
61350+
function applyPolicy(count) {
61351+
const fileName = `step_policy_apply_${count}`;
61352+
cp.execSync(`echo "${fileName}" > "${getRunnerTempDir()}/${fileName}"`);
61353+
}
61354+
function removeStepPolicyFiles() {
61355+
external_child_process_.execSync(`rm ${getRunnerTempDir()}/step_policy_*`);
61356+
}
61357+
function arcCleanUp() {
61358+
external_child_process_.execSync(`echo "cleanup" > "${getRunnerTempDir()}/step_policy_cleanup"`);
61359+
}
61360+
6132561361
;// CONCATENATED MODULE: ./src/cleanup.ts
6132661362
var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
6132761363
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -61339,6 +61375,7 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6133961375

6134061376

6134161377

61378+
6134261379
(() => cleanup_awaiter(void 0, void 0, void 0, function* () {
6134361380
if (process.platform !== "linux") {
6134461381
console.log(UBUNTU_MESSAGE);
@@ -61348,6 +61385,21 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6134861385
console.log(CONTAINER_MESSAGE);
6134961386
return;
6135061387
}
61388+
if (isValidEvent()) {
61389+
try {
61390+
const cacheResult = yield cache.saveCache([external_path_default().join(__dirname, "cache.txt")], cacheKey);
61391+
console.log(cacheResult);
61392+
}
61393+
catch (exception) {
61394+
console.log(exception);
61395+
}
61396+
}
61397+
if (isArcRunner()) {
61398+
console.log(`[!] ${ARC_RUNNER_MESSAGE}`);
61399+
arcCleanUp();
61400+
removeStepPolicyFiles();
61401+
return;
61402+
}
6135161403
if (String(process.env.STATE_monitorStatusCode) ===
6135261404
STATUS_HARDEN_RUNNER_UNAVAILABLE) {
6135361405
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
@@ -61389,18 +61441,6 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6138961441
console.log("Service log:");
6139061442
console.log(journalLog);
6139161443
}
61392-
if (isValidEvent()) {
61393-
try {
61394-
const cmd = "cp";
61395-
const args = [external_path_default().join(__dirname, "cache.txt"), cacheFile];
61396-
external_child_process_.execFileSync(cmd, args);
61397-
const cacheResult = yield cache.saveCache([cacheFile], cacheKey);
61398-
console.log(cacheResult);
61399-
}
61400-
catch (exception) {
61401-
console.log(exception);
61402-
}
61403-
}
6140461444
try {
6140561445
yield addSummary();
6140661446
}

0 commit comments

Comments
 (0)