mirror of
https://github.com/step-security/harden-runner.git
synced 2026-06-06 06:17:07 +00:00
Merge pull request #20 from step-security/feature-16
Add color and move link to new line
This commit is contained in:
commit
9bba600d52
10 changed files with 64 additions and 38 deletions
59
dist/index.js
vendored
59
dist/index.js
vendored
|
|
@ -1,10 +1,37 @@
|
|||
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
/******/ "use strict";
|
||||
/******/ // The require scope
|
||||
/******/ var __nccwpck_require__ = {};
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/make namespace object */
|
||||
/******/ (() => {
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __nccwpck_require__.r = (exports) => {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/compat */
|
||||
/******/
|
||||
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// ESM COMPAT FLAG
|
||||
__nccwpck_require__.r(__webpack_exports__);
|
||||
|
||||
/***/ 144:
|
||||
/***/ (function() {
|
||||
;// CONCATENATED MODULE: ./src/common.ts
|
||||
function printInfo(web_url) {
|
||||
console.log("\x1b[32m%s\x1b[0m", "View security insights and recommended policy at:");
|
||||
console.log(`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`);
|
||||
}
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
;// CONCATENATED MODULE: ./src/index.ts
|
||||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
|
|
@ -13,33 +40,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
(() => __awaiter(this, void 0, void 0, function* () {
|
||||
|
||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (process.platform !== "linux") {
|
||||
console.log("Only runs on linux");
|
||||
return;
|
||||
}
|
||||
var web_url = "https://app.stepsecurity.io";
|
||||
console.log(`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`);
|
||||
printInfo(web_url);
|
||||
}))();
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/compat */
|
||||
/******/
|
||||
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = {};
|
||||
/******/ __webpack_modules__[144]();
|
||||
/******/ module.exports = __webpack_exports__;
|
||||
/******/
|
||||
module.exports = __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sources":["../webpack://step-security-harden-runner/./src/index.ts","../webpack://step-security-harden-runner/webpack/runtime/compat","../webpack://step-security-harden-runner/webpack/startup"],"sourcesContent":["(async () => {\n if (process.platform !== \"linux\") {\n console.log(\"Only runs on linux\");\n return;\n }\n\n var web_url = \"https://app.stepsecurity.io\";\n\n console.log(\n `View security insights and recommended policy at ${web_url}/github/${process.env[\"GITHUB_REPOSITORY\"]}/actions/runs/${process.env[\"GITHUB_RUN_ID\"]} after the run has finished`\n );\n})();\n","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + \"/\";","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[144]();\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAGA;;;A;;;;;ACXA;AACA;;;;ACDA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}
|
||||
{"version":3,"file":"index.js","sources":["../webpack://step-security-harden-runner/webpack/bootstrap","../webpack://step-security-harden-runner/webpack/runtime/make namespace object","../webpack://step-security-harden-runner/webpack/runtime/compat","../webpack://step-security-harden-runner/./src/common.ts","../webpack://step-security-harden-runner/./src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + \"/\";","export function printInfo(web_url) {\n console.log(\n \"\\x1b[32m%s\\x1b[0m\",\n \"View security insights and recommended policy at:\"\n );\n\n console.log(\n `${web_url}/github/${process.env[\"GITHUB_REPOSITORY\"]}/actions/runs/${process.env[\"GITHUB_RUN_ID\"]}`\n );\n}\n","import { printInfo } from \"./common\";\n\n(async () => {\n if (process.platform !== \"linux\") {\n console.log(\"Only runs on linux\");\n return;\n }\n\n var web_url = \"https://app.stepsecurity.io\";\n printInfo(web_url);\n})();\n"],"mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACNA;AACA;;;;;;;;ACDA;AACA;AAKA;AAGA;;;;;;;;;;;;ACTA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;;;A","sourceRoot":""}
|
||||
2
dist/post/index.js
vendored
2
dist/post/index.js
vendored
|
|
@ -48,7 +48,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|||
while (true) {
|
||||
if (!external_fs_namespaceObject.existsSync(doneFile)) {
|
||||
counter++;
|
||||
if (counter > 30) {
|
||||
if (counter > 10) {
|
||||
console.log("timed out");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sources":["../webpack://step-security-harden-runner/webpack/bootstrap","../webpack://step-security-harden-runner/webpack/runtime/make namespace object","../webpack://step-security-harden-runner/webpack/runtime/compat","../webpack://step-security-harden-runner/external \"fs\"","../webpack://step-security-harden-runner/./src/cleanup.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + \"/\";","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs\");","import * as fs from \"fs\";\n\n(async () => {\n if (process.platform !== \"linux\") {\n console.log(\"Only runs on linux\");\n return;\n }\n\n fs.writeFileSync(\n \"/home/agent/post_event.json\",\n JSON.stringify({ event: \"post\" })\n );\n\n var doneFile = \"/home/agent/done.json\";\n var counter = 0;\n while (true) {\n if (!fs.existsSync(doneFile)) {\n counter++;\n if (counter > 30) {\n console.log(\"timed out\");\n\n break;\n }\n await sleep(1000);\n } // The file *does* exist\n else {\n break;\n }\n }\n\n var log = \"/home/agent/agent.log\";\n console.log(\"log:\");\n var content = fs.readFileSync(log, \"utf-8\");\n console.log(content);\n var status = \"/home/agent/agent.status\";\n if (fs.existsSync(status)) {\n console.log(\"status:\");\n var content = fs.readFileSync(status, \"utf-8\");\n console.log(content);\n }\n})();\n\nfunction sleep(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACNA;AACA;;;;;;;;ACDA;;;;;;;;;;;ACAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}
|
||||
{"version":3,"file":"index.js","sources":["../webpack://step-security-harden-runner/webpack/bootstrap","../webpack://step-security-harden-runner/webpack/runtime/make namespace object","../webpack://step-security-harden-runner/webpack/runtime/compat","../webpack://step-security-harden-runner/external \"fs\"","../webpack://step-security-harden-runner/./src/cleanup.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + \"/\";","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs\");","import * as fs from \"fs\";\n\n(async () => {\n if (process.platform !== \"linux\") {\n console.log(\"Only runs on linux\");\n return;\n }\n\n fs.writeFileSync(\n \"/home/agent/post_event.json\",\n JSON.stringify({ event: \"post\" })\n );\n\n var doneFile = \"/home/agent/done.json\";\n var counter = 0;\n while (true) {\n if (!fs.existsSync(doneFile)) {\n counter++;\n if (counter > 10) {\n console.log(\"timed out\");\n\n break;\n }\n await sleep(1000);\n } // The file *does* exist\n else {\n break;\n }\n }\n\n var log = \"/home/agent/agent.log\";\n console.log(\"log:\");\n var content = fs.readFileSync(log, \"utf-8\");\n console.log(content);\n var status = \"/home/agent/agent.status\";\n if (fs.existsSync(status)) {\n console.log(\"status:\");\n var content = fs.readFileSync(status, \"utf-8\");\n console.log(content);\n }\n})();\n\nfunction sleep(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACNA;AACA;;;;;;;;ACDA;;;;;;;;;;;ACAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}
|
||||
9
dist/pre/index.js
vendored
9
dist/pre/index.js
vendored
|
|
@ -2370,6 +2370,12 @@ const validate = dist/* validate */.Gu;
|
|||
const stringify = dist/* stringify */.Pz;
|
||||
const parse = dist/* parse */.Qc;
|
||||
|
||||
;// CONCATENATED MODULE: ./src/common.ts
|
||||
function printInfo(web_url) {
|
||||
console.log("\x1b[32m%s\x1b[0m", "View security insights and recommended policy at:");
|
||||
console.log(`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./src/setup.ts
|
||||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
|
|
@ -2386,6 +2392,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|||
|
||||
|
||||
|
||||
|
||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
if (process.platform !== "linux") {
|
||||
|
|
@ -2416,7 +2423,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|||
.on("finish", () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
filePath.close();
|
||||
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
|
||||
console.log(`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`);
|
||||
printInfo(web_url);
|
||||
let cmd = "cp", args = [external_path_.join(__dirname, "agent"), "/home/agent/agent"];
|
||||
external_child_process_namespaceObject.execFileSync(cmd, args);
|
||||
external_child_process_namespaceObject.execSync("chmod +x /home/agent/agent");
|
||||
|
|
|
|||
2
dist/pre/index.js.map
vendored
2
dist/pre/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,7 @@ import * as fs from "fs";
|
|||
while (true) {
|
||||
if (!fs.existsSync(doneFile)) {
|
||||
counter++;
|
||||
if (counter > 30) {
|
||||
if (counter > 10) {
|
||||
console.log("timed out");
|
||||
|
||||
break;
|
||||
|
|
|
|||
10
src/common.ts
Normal file
10
src/common.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export function printInfo(web_url) {
|
||||
console.log(
|
||||
"\x1b[32m%s\x1b[0m",
|
||||
"View security insights and recommended policy at:"
|
||||
);
|
||||
|
||||
console.log(
|
||||
`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`
|
||||
);
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
import { printInfo } from "./common";
|
||||
|
||||
(async () => {
|
||||
if (process.platform !== "linux") {
|
||||
console.log("Only runs on linux");
|
||||
|
|
@ -5,8 +7,5 @@
|
|||
}
|
||||
|
||||
var web_url = "https://app.stepsecurity.io";
|
||||
|
||||
console.log(
|
||||
`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`
|
||||
);
|
||||
printInfo(web_url);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import * as core from "@actions/core";
|
||||
import { context } from "@actions/github/lib/utils";
|
||||
import * as cp from "child_process";
|
||||
import * as fs from "fs";
|
||||
import * as https from "https";
|
||||
import * as path from "path";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { printInfo } from "./common";
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
|
|
@ -43,9 +43,8 @@ import { v4 as uuidv4 } from "uuid";
|
|||
filePath.close();
|
||||
|
||||
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
|
||||
console.log(
|
||||
`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`
|
||||
);
|
||||
printInfo(web_url);
|
||||
|
||||
let cmd = "cp",
|
||||
args = [path.join(__dirname, "agent"), "/home/agent/agent"];
|
||||
cp.execFileSync(cmd, args);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue