Skip to content

Commit ec9f2d5

Browse files
Merge pull request #565 from step-security/rc-24
Release v2.13.0
2 parents 6c439dc + 04bcbc3 commit ec9f2d5

File tree

10 files changed

+123
-256
lines changed

10 files changed

+123
-256
lines changed

dist/index.js

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -27615,7 +27615,7 @@ var external_fs_ = __nccwpck_require__(5747);
2761527615
;// CONCATENATED MODULE: ./src/configs.ts
2761627616
const STEPSECURITY_ENV = "agent"; // agent or int
2761727617
const configs_STEPSECURITY_API_URL = `https://${STEPSECURITY_ENV}.api.stepsecurity.io/v1`;
27618-
const configs_STEPSECURITY_WEB_URL = "https://app.stepsecurity.io";
27618+
const STEPSECURITY_WEB_URL = "https://app.stepsecurity.io";
2761927619

2762027620
;// CONCATENATED MODULE: ./src/common.ts
2762127621
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -27658,14 +27658,13 @@ const processLogLine = (line, tableEntries) => {
2765827658
}
2765927659
};
2766027660
function addSummary() {
27661+
var _a;
2766127662
return __awaiter(this, void 0, void 0, function* () {
2766227663
if (process.env.STATE_addSummary !== "true") {
2766327664
return;
2766427665
}
27665-
const web_url = STEPSECURITY_WEB_URL;
27666-
const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
27667-
const log = "/home/agent/agent.log";
27668-
if (!fs.existsSync(log)) {
27666+
const correlation_id = process.env.STATE_correlation_id;
27667+
if (!correlation_id) {
2766927668
return;
2767027669
}
2767127670
let needsSubscription = false;
@@ -27691,62 +27690,29 @@ function addSummary() {
2769127690
.write();
2769227691
return;
2769327692
}
27694-
const content = fs.readFileSync(log, "utf-8");
27695-
const lines = content.split("\n");
27696-
let tableEntries = [];
27697-
for (const line of lines) {
27698-
processLogLine(line, tableEntries);
27699-
}
27700-
if (tableEntries.length === 0) {
27693+
// Extract owner and repo from GITHUB_REPOSITORY (format: owner/repo)
27694+
const [owner, repo] = ((_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.split("/")) || [];
27695+
const run_id = process.env["GITHUB_RUN_ID"];
27696+
if (!owner || !repo || !run_id || !correlation_id) {
2770127697
return;
2770227698
}
27703-
const insightsRow = `<p><b><a href="${insights_url}">📄 View Full Report</a></b></p>`;
27704-
yield core.summary.addSeparator().addRaw(`<h2>🛡 StepSecurity Report</h2>`);
27705-
tableEntries.sort((a, b) => {
27706-
if (a.status === "❌ Blocked" && b.status !== "❌ Blocked") {
27707-
return -1;
27708-
}
27709-
else if (a.status !== "❌ Blocked" && b.status === "❌ Blocked") {
27710-
return 1;
27711-
}
27712-
else {
27713-
return 0;
27699+
// Fetch job summary from API
27700+
const apiUrl = `${STEPSECURITY_API_URL}/github/${owner}/${repo}/actions/runs/${run_id}/correlation/${correlation_id}/job-markdown-summary`;
27701+
try {
27702+
const response = yield fetch(apiUrl);
27703+
if (!response.ok) {
27704+
console.error(`Failed to fetch job summary: ${response.status} ${response.statusText}`);
27705+
return;
2771427706
}
27715-
});
27716-
tableEntries = tableEntries.slice(0, 3);
27717-
yield core.summary.addRaw(`
27718-
<blockquote>
27719-
<p>Preview of the outbound network calls during this workflow run.</p></blockquote>
27720-
<h3>Network Calls</h3>
27721-
<table>
27722-
<thead>
27723-
<tr>
27724-
<th>Process</th>
27725-
<th>Destination</th>
27726-
<th>Status</th>
27727-
</tr>
27728-
</thead>
27729-
<tbody>
27730-
${tableEntries
27731-
.map((entry) => `<tr>
27732-
<td><code>${entry.process}</code></td>
27733-
<td>${entry.domain.replace(/\.$/, "")}</td>
27734-
<td>${entry.status}</td>
27735-
</tr>`)
27736-
.join("")}
27737-
<tr>
27738-
<td><code>...</code></td>
27739-
<td><code>...</code></td>
27740-
<td><code>...</code></td>
27741-
</tr>
27742-
</tbody>
27743-
</table>
27744-
${insightsRow}
27745-
`);
27746-
yield core.summary
27747-
.addRaw(`<p><i>Markdown generated by the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a>.</i></p>`)
27748-
.addSeparator()
27749-
.write();
27707+
const markdownSummary = yield response.text();
27708+
// Render the markdown summary using core.summary.addRaw
27709+
yield core.summary.addRaw(markdownSummary).write();
27710+
return;
27711+
}
27712+
catch (error) {
27713+
console.error(`Error fetching job summary: ${error}`);
27714+
return;
27715+
}
2775027716
});
2775127717
}
2775227718
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
@@ -27871,7 +27837,7 @@ var src_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argu
2787127837
console.log("Telemetry will not be sent to StepSecurity API as disable-telemetry is set to true");
2787227838
}
2787327839
else {
27874-
var web_url = configs_STEPSECURITY_WEB_URL;
27840+
var web_url = STEPSECURITY_WEB_URL;
2787527841
printInfo(web_url);
2787627842
}
2787727843
}))();

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: 23 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27660,14 +27660,13 @@ const processLogLine = (line, tableEntries) => {
2766027660
}
2766127661
};
2766227662
function addSummary() {
27663+
var _a;
2766327664
return __awaiter(this, void 0, void 0, function* () {
2766427665
if (process.env.STATE_addSummary !== "true") {
2766527666
return;
2766627667
}
27667-
const web_url = STEPSECURITY_WEB_URL;
27668-
const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
27669-
const log = "/home/agent/agent.log";
27670-
if (!external_fs_.existsSync(log)) {
27668+
const correlation_id = process.env.STATE_correlation_id;
27669+
if (!correlation_id) {
2767127670
return;
2767227671
}
2767327672
let needsSubscription = false;
@@ -27691,61 +27690,29 @@ function addSummary() {
2769127690
.write();
2769227691
return;
2769327692
}
27694-
const content = external_fs_.readFileSync(log, "utf-8");
27695-
const lines = content.split("\n");
27696-
let tableEntries = [];
27697-
for (const line of lines) {
27698-
processLogLine(line, tableEntries);
27699-
}
27700-
if (tableEntries.length === 0) {
27693+
// Extract owner and repo from GITHUB_REPOSITORY (format: owner/repo)
27694+
const [owner, repo] = ((_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.split("/")) || [];
27695+
const run_id = process.env["GITHUB_RUN_ID"];
27696+
if (!owner || !repo || !run_id || !correlation_id) {
2770127697
return;
2770227698
}
27703-
const insightsRow = `<p><b><a href="${insights_url}">📄 View Full Report</a></b></p>`;
27704-
yield lib_core.summary.addSeparator().addRaw(`<h2>🛡 StepSecurity Report</h2>`);
27705-
tableEntries.sort((a, b) => {
27706-
if (a.status === "❌ Blocked" && b.status !== "❌ Blocked") {
27707-
return -1;
27708-
}
27709-
else if (a.status !== "❌ Blocked" && b.status === "❌ Blocked") {
27710-
return 1;
27711-
}
27712-
else {
27713-
return 0;
27699+
// Fetch job summary from API
27700+
const apiUrl = `${configs_STEPSECURITY_API_URL}/github/${owner}/${repo}/actions/runs/${run_id}/correlation/${correlation_id}/job-markdown-summary`;
27701+
try {
27702+
const response = yield fetch(apiUrl);
27703+
if (!response.ok) {
27704+
console.error(`Failed to fetch job summary: ${response.status} ${response.statusText}`);
27705+
return;
2771427706
}
27715-
});
27716-
tableEntries = tableEntries.slice(0, 3);
27717-
yield lib_core.summary.addRaw(`
27718-
<blockquote>
27719-
<p>Preview of the outbound network calls during this workflow run.</p></blockquote>
27720-
<h3>Network Calls</h3>
27721-
<table>
27722-
<thead>
27723-
<tr>
27724-
<th>Process</th>
27725-
<th>Destination</th>
27726-
<th>Status</th>
27727-
</tr>
27728-
</thead>
27729-
<tbody>
27730-
${tableEntries
27731-
.map((entry) => `<tr>
27732-
<td><code>${entry.process}</code></td>
27733-
<td>${entry.domain.replace(/\.$/, "")}</td>
27734-
<td>${entry.status}</td>
27735-
</tr>`)
27736-
.join("")}
27737-
<tr>
27738-
<td><code>...</code></td>
27739-
<td><code>...</code></td>
27740-
<td><code>...</code></td>
27741-
</tr>
27742-
</tbody>
27743-
</table>
27744-
${insightsRow}
27745-
`);
27746-
yield lib_core.summary.addRaw(`<p><i>Markdown generated by the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a>.</i></p>`)
27747-
.addSeparator()
27748-
.write();
27707+
const markdownSummary = yield response.text();
27708+
// Render the markdown summary using core.summary.addRaw
27709+
yield lib_core.summary.addRaw(markdownSummary).write();
27710+
return;
27711+
}
27712+
catch (error) {
27713+
console.error(`Error fetching job summary: ${error}`);
27714+
return;
27715+
}
2774927716
});
2775027717
}
2775127718
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";

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: 35 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -87641,8 +87641,8 @@ const parse = dist/* parse */.Qc;
8764187641

8764287642
;// CONCATENATED MODULE: ./src/configs.ts
8764387643
const STEPSECURITY_ENV = "agent"; // agent or int
87644-
const STEPSECURITY_API_URL = `https://${STEPSECURITY_ENV}.api.stepsecurity.io/v1`;
87645-
const configs_STEPSECURITY_WEB_URL = "https://app.stepsecurity.io";
87644+
const configs_STEPSECURITY_API_URL = `https://${STEPSECURITY_ENV}.api.stepsecurity.io/v1`;
87645+
const STEPSECURITY_WEB_URL = "https://app.stepsecurity.io";
8764687646

8764787647
;// CONCATENATED MODULE: ./src/common.ts
8764887648
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -87685,14 +87685,13 @@ const processLogLine = (line, tableEntries) => {
8768587685
}
8768687686
};
8768787687
function addSummary() {
87688+
var _a;
8768887689
return __awaiter(this, void 0, void 0, function* () {
8768987690
if (process.env.STATE_addSummary !== "true") {
8769087691
return;
8769187692
}
87692-
const web_url = STEPSECURITY_WEB_URL;
87693-
const insights_url = `${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`;
87694-
const log = "/home/agent/agent.log";
87695-
if (!fs.existsSync(log)) {
87693+
const correlation_id = process.env.STATE_correlation_id;
87694+
if (!correlation_id) {
8769687695
return;
8769787696
}
8769887697
let needsSubscription = false;
@@ -87718,62 +87717,29 @@ function addSummary() {
8771887717
.write();
8771987718
return;
8772087719
}
87721-
const content = fs.readFileSync(log, "utf-8");
87722-
const lines = content.split("\n");
87723-
let tableEntries = [];
87724-
for (const line of lines) {
87725-
processLogLine(line, tableEntries);
87726-
}
87727-
if (tableEntries.length === 0) {
87720+
// Extract owner and repo from GITHUB_REPOSITORY (format: owner/repo)
87721+
const [owner, repo] = ((_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.split("/")) || [];
87722+
const run_id = process.env["GITHUB_RUN_ID"];
87723+
if (!owner || !repo || !run_id || !correlation_id) {
8772887724
return;
8772987725
}
87730-
const insightsRow = `<p><b><a href="${insights_url}">📄 View Full Report</a></b></p>`;
87731-
yield core.summary.addSeparator().addRaw(`<h2>🛡 StepSecurity Report</h2>`);
87732-
tableEntries.sort((a, b) => {
87733-
if (a.status === "❌ Blocked" && b.status !== "❌ Blocked") {
87734-
return -1;
87735-
}
87736-
else if (a.status !== "❌ Blocked" && b.status === "❌ Blocked") {
87737-
return 1;
87738-
}
87739-
else {
87740-
return 0;
87726+
// Fetch job summary from API
87727+
const apiUrl = `${STEPSECURITY_API_URL}/github/${owner}/${repo}/actions/runs/${run_id}/correlation/${correlation_id}/job-markdown-summary`;
87728+
try {
87729+
const response = yield fetch(apiUrl);
87730+
if (!response.ok) {
87731+
console.error(`Failed to fetch job summary: ${response.status} ${response.statusText}`);
87732+
return;
8774187733
}
87742-
});
87743-
tableEntries = tableEntries.slice(0, 3);
87744-
yield core.summary.addRaw(`
87745-
<blockquote>
87746-
<p>Preview of the outbound network calls during this workflow run.</p></blockquote>
87747-
<h3>Network Calls</h3>
87748-
<table>
87749-
<thead>
87750-
<tr>
87751-
<th>Process</th>
87752-
<th>Destination</th>
87753-
<th>Status</th>
87754-
</tr>
87755-
</thead>
87756-
<tbody>
87757-
${tableEntries
87758-
.map((entry) => `<tr>
87759-
<td><code>${entry.process}</code></td>
87760-
<td>${entry.domain.replace(/\.$/, "")}</td>
87761-
<td>${entry.status}</td>
87762-
</tr>`)
87763-
.join("")}
87764-
<tr>
87765-
<td><code>...</code></td>
87766-
<td><code>...</code></td>
87767-
<td><code>...</code></td>
87768-
</tr>
87769-
</tbody>
87770-
</table>
87771-
${insightsRow}
87772-
`);
87773-
yield core.summary
87774-
.addRaw(`<p><i>Markdown generated by the <a href="https://github.com/step-security/harden-runner">Harden-Runner GitHub Action</a>.</i></p>`)
87775-
.addSeparator()
87776-
.write();
87734+
const markdownSummary = yield response.text();
87735+
// Render the markdown summary using core.summary.addRaw
87736+
yield core.summary.addRaw(markdownSummary).write();
87737+
return;
87738+
}
87739+
catch (error) {
87740+
console.error(`Error fetching job summary: ${error}`);
87741+
return;
87742+
}
8777787743
});
8777887744
}
8777987745
const STATUS_HARDEN_RUNNER_UNAVAILABLE = "409";
@@ -87855,7 +87821,7 @@ function fetchPolicy(owner, policyName, idToken) {
8785587821
if (idToken === "") {
8785687822
throw new Error("[PolicyFetch]: id-token in empty");
8785787823
}
87858-
let policyEndpoint = `${STEPSECURITY_API_URL}/github/${owner}/actions/policies/${policyName}`;
87824+
let policyEndpoint = `${configs_STEPSECURITY_API_URL}/github/${owner}/actions/policies/${policyName}`;
8785987825
let httpClient = new lib.HttpClient();
8786087826
let headers = {};
8786187827
headers["Authorization"] = `Bearer ${idToken}`;
@@ -87978,7 +87944,7 @@ var tls_inspect_awaiter = (undefined && undefined.__awaiter) || function (thisAr
8797887944

8797987945
function isTLSEnabled(owner) {
8798087946
return tls_inspect_awaiter(this, void 0, void 0, function* () {
87981-
let tlsStatusEndpoint = `${STEPSECURITY_API_URL}/github/${owner}/actions/tls-inspection-status`;
87947+
let tlsStatusEndpoint = `${configs_STEPSECURITY_API_URL}/github/${owner}/actions/tls-inspection-status`;
8798287948
let httpClient = new lib.HttpClient();
8798387949
httpClient.requestOptions = { socketTimeout: 3 * 1000 };
8798487950
lib_core.info(`[!] Checking TLS_STATUS: ${owner}`);
@@ -88014,8 +87980,8 @@ var external_crypto_ = __nccwpck_require__(6417);
8801487980

8801587981
const CHECKSUMS = {
8801687982
tls: {
88017-
amd64: "3f2dc32f300071289650d1f9cbd3c04527ff8cc13e213eeccb70d4d6d2a0c8d5",
88018-
arm64: "96967e419b358b664658fa218b712fdb439ffb8eef3bb7b170f122d1e96b4779",
87983+
amd64: "5c02a40df6e2c926c92ffc6bf02ca8a301649d44541ca57e40a87948fb0d3f2e",
87984+
arm64: "b953784a468343c44a1a3ef4ec984c738a9a1e84aaf6932a2bb9dbf7ac7eab29",
8801987985
},
8802087986
non_tls: {
8802187987
amd64: "336093af8ebe969567b66fd035af3bd4f7e1c723ce680d6b4b5b2a1f79bc329e", // v0.14.2
@@ -88068,7 +88034,7 @@ function installAgent(isTLS, configStr) {
8806888034
encoding: "utf8",
8806988035
});
8807088036
if (isTLS) {
88071-
downloadPath = yield tool_cache.downloadTool(`https://packages.stepsecurity.io/github-hosted/harden-runner_1.6.15_linux_${variant}.tar.gz`);
88037+
downloadPath = yield tool_cache.downloadTool(`https://packages.stepsecurity.io/github-hosted/harden-runner_1.6.18_linux_${variant}.tar.gz`);
8807288038
}
8807388039
else {
8807488040
if (variant === "arm64") {
@@ -88140,8 +88106,8 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
8814088106
return;
8814188107
}
8814288108
var correlation_id = v4();
88143-
var api_url = STEPSECURITY_API_URL;
88144-
var web_url = configs_STEPSECURITY_WEB_URL;
88109+
var api_url = configs_STEPSECURITY_API_URL;
88110+
var web_url = STEPSECURITY_WEB_URL;
8814588111
let confg = {
8814688112
repo: process.env["GITHUB_REPOSITORY"],
8814788113
run_id: process.env["GITHUB_RUN_ID"],
@@ -88297,6 +88263,9 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
8829788263
external_fs_.appendFileSync(process.env.GITHUB_STATE, `addSummary=${addSummary}${external_os_.EOL}`, {
8829888264
encoding: "utf8",
8829988265
});
88266+
external_fs_.appendFileSync(process.env.GITHUB_STATE, `correlation_id=${correlation_id}${external_os_.EOL}`, {
88267+
encoding: "utf8",
88268+
});
8830088269
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
8830188270
if (String(statusCode) === STATUS_HARDEN_RUNNER_UNAVAILABLE) {
8830288271
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);

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.

0 commit comments

Comments
 (0)