Skip to content

Commit 55d479f

Browse files
Release v2.4.1 (#309)
1 parent 215c5ca commit 55d479f

15 files changed

+496
-86
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ GitHub-hosted runner uses passwordless sudo for running jobs.
113113

114114
### 🔔 Get security alerts
115115

116-
Install the [Harden Runner App](https://github.com/marketplace/harden-runner-app) to get security alerts.
116+
Install the [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) to get security alerts.
117117

118118
- Email and Slack notifications are supported
119119
- Notifications are sent when outbound traffic is blocked or source code is overwritten
@@ -123,11 +123,11 @@ Install the [Harden Runner App](https://github.com/marketplace/harden-runner-app
123123

124124
Private repositories are supported if they have a commercial license. Check out the [documentation](https://docs.stepsecurity.io/harden-runner/installation/business-enterprise-license) for more details.
125125

126-
Install the [Harden Runner App](https://github.com/marketplace/harden-runner-app) to use Harden-Runner GitHub Action for `Private` repositories.
126+
Install the [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) to use Harden-Runner GitHub Action for `Private` repositories.
127127

128128
- If you use Harden-Runner GitHub Action in a private repository, the generated insights URL is NOT public.
129129
- You need to authenticate first to access insights URL for private repository. Only those who have access to the repository can view it.
130-
- [Harden Runner App](https://github.com/marketplace/harden-runner-app) only needs `actions: read` permissions on your repositories.
130+
- [StepSecurity Actions Security GitHub App](https://github.com/apps/stepsecurity-actions-security) only needs `actions: read` permissions on your repositories.
131131

132132
Read this [case study on how Kapiche uses Harden Runner](https://www.stepsecurity.io/case-studies/kapiche/) to improve software supply chain security in their open source and private repositories.
133133

dist/index.js

+107-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

+103-17
Original file line numberDiff line numberDiff line change
@@ -61147,24 +61147,119 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
6114761147
});
6114861148
};
6114961149

61150+
6115061151
function printInfo(web_url) {
6115161152
console.log("\x1b[32m%s\x1b[0m", "View security insights and recommended policy at:");
6115261153
console.log(`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`);
6115361154
}
61155+
const processLogLine = (line, tableEntries) => {
61156+
if (line.includes("pid") &&
61157+
line.includes("process") &&
61158+
line.includes("domain") &&
61159+
line.includes("ip address")) {
61160+
const matches = line.match(/ip address:port ([\d.:]+), domain: ([\w.-]+), pid: (\d+), process: (\w+)/);
61161+
if (matches) {
61162+
const [ipAddress, domain, pid, process] = matches.slice(1);
61163+
// Check if all values are non-empty
61164+
if (pid && process && domain && ipAddress) {
61165+
const status = ipAddress.startsWith("54.185.253.63")
61166+
? "❌ Blocked"
61167+
: "✅ Allowed";
61168+
tableEntries.push({ pid, process, domain, ipAddress, status });
61169+
}
61170+
}
61171+
}
61172+
};
6115461173
function addSummary() {
6115561174
return __awaiter(this, void 0, void 0, function* () {
61156-
if (process.env.STATE_monitorStatusCode === "200") {
61157-
const web_url = "https://app.stepsecurity.io";
61158-
const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
61175+
if (process.env.STATE_monitorStatusCode !== "200") {
61176+
return;
61177+
}
61178+
const web_url = "https://app.stepsecurity.io";
61179+
const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
61180+
const log = "/home/agent/agent.log";
61181+
if (!external_fs_.existsSync(log)) {
61182+
return;
61183+
}
61184+
let needsSubscription = false;
61185+
try {
61186+
let data = external_fs_.readFileSync("/home/agent/annotation.log", "utf8");
61187+
if (data.includes("StepSecurity Harden Runner is disabled")) {
61188+
needsSubscription = true;
61189+
}
61190+
}
61191+
catch (err) {
61192+
//console.error(err);
61193+
}
61194+
if (needsSubscription) {
6115961195
yield core.summary.addSeparator()
61160-
.addRaw(`<p><picture>
61161-
<source media="(prefers-color-scheme: light)" srcset="https://github.com/step-security/harden-runner/raw/main/images/banner.png" width="200">
61162-
<img alt="Dark Banner" src="https://github.com/step-security/harden-runner/raw/main/images/banner-dark.png" width="200">
61163-
</picture></p>`, true)
61164-
.addLink("View security insights and recommended policy", insights_url)
61196+
.addRaw(`<h2>❌ GitHub Actions Runtime Security is disabled</h2>`);
61197+
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>
61200+
`)
6116561201
.addSeparator()
6116661202
.write();
61203+
return;
6116761204
}
61205+
const content = external_fs_.readFileSync(log, "utf-8");
61206+
const lines = content.split("\n");
61207+
let tableEntries = [];
61208+
for (const line of lines) {
61209+
processLogLine(line, tableEntries);
61210+
}
61211+
if (tableEntries.length === 0) {
61212+
return;
61213+
}
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>`);
61219+
tableEntries.sort((a, b) => {
61220+
if (a.status === "❌ Blocked" && b.status !== "❌ Blocked") {
61221+
return -1;
61222+
}
61223+
else if (a.status !== "❌ Blocked" && b.status === "❌ Blocked") {
61224+
return 1;
61225+
}
61226+
else {
61227+
return 0;
61228+
}
61229+
});
61230+
tableEntries = tableEntries.slice(0, 3);
61231+
yield core.summary.addRaw(`
61232+
<h3>🌐 Network Events</h3>
61233+
<table>
61234+
<thead>
61235+
<tr>
61236+
<th>Process</th>
61237+
<th>Endpoint</th>
61238+
<th>Status</th>
61239+
</tr>
61240+
</thead>
61241+
<tbody>
61242+
${tableEntries
61243+
.map((entry) => `<tr>
61244+
<td>${entry.process}</td>
61245+
<td>${entry.domain.replace(/\.$/, "")}</td>
61246+
<td>${entry.status}</td>
61247+
</tr>`)
61248+
.join("")}
61249+
<tr>
61250+
<td>...</td>
61251+
<td>...</td>
61252+
<td>...</td>
61253+
</tr>
61254+
${insightsRow}
61255+
</tbody>
61256+
</table>
61257+
`);
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>`)
61261+
.addSeparator()
61262+
.write();
6116861263
});
6116961264
}
6117061265
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
@@ -61244,7 +61339,6 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6124461339

6124561340

6124661341

61247-
6124861342
(() => cleanup_awaiter(void 0, void 0, void 0, function* () {
6124961343
if (process.platform !== "linux") {
6125061344
console.log(UBUNTU_MESSAGE);
@@ -61287,14 +61381,6 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
6128761381
var content = external_fs_.readFileSync(status, "utf-8");
6128861382
console.log(content);
6128961383
}
61290-
// write annotations
61291-
var annotationsFile = "/home/agent/annotation.log";
61292-
if (external_fs_.existsSync(annotationsFile)) {
61293-
var content = external_fs_.readFileSync(annotationsFile, "utf-8");
61294-
content.split(/\r?\n/).forEach((line) => {
61295-
core.error(line);
61296-
});
61297-
}
6129861384
var disable_sudo = process.env.STATE_disableSudo;
6129961385
if (disable_sudo !== "true") {
6130061386
var journalLog = external_child_process_.execSync("sudo journalctl -u agent.service", {

dist/post/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)