mirror of
https://github.com/step-security/harden-runner.git
synced 2026-06-07 15:17:12 +00:00
otk: added one-time-key logic
Signed-off-by: h0x0er <jatink843@protonmail.com>
This commit is contained in:
parent
6d3c2fe731
commit
08947d3b5b
3 changed files with 6 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ export interface Configuration {
|
|||
is_github_hosted: boolean;
|
||||
private: string;
|
||||
is_debug: boolean;
|
||||
one_time_key: string;
|
||||
}
|
||||
|
||||
export interface PolicyResponse {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ test("merge configs", async () => {
|
|||
private: "true",
|
||||
is_github_hosted: true,
|
||||
is_debug: false,
|
||||
one_time_key: "",
|
||||
};
|
||||
let policyResponse: PolicyResponse = {
|
||||
owner: "h0x0er",
|
||||
|
|
@ -65,6 +66,7 @@ test("merge configs", async () => {
|
|||
private: "true",
|
||||
is_github_hosted: true,
|
||||
is_debug: false,
|
||||
one_time_key: "",
|
||||
};
|
||||
|
||||
localConfig = mergeConfigs(localConfig, policyResponse);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import { isGithubHosted, isTLSEnabled } from "./tls-inspect";
|
|||
|
||||
interface MonitorResponse {
|
||||
runner_ip_address?: string;
|
||||
one_time_key?: string;
|
||||
monitoring_started?: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ interface MonitorResponse {
|
|||
private: context?.payload?.repository?.private || false,
|
||||
is_github_hosted: isGithubHosted(),
|
||||
is_debug: core.isDebug(),
|
||||
one_time_key: "",
|
||||
};
|
||||
|
||||
let policyName = core.getInput("policy");
|
||||
|
|
@ -200,6 +202,7 @@ interface MonitorResponse {
|
|||
|
||||
if (statusCode === 200 && responseData) {
|
||||
console.log(`Runner IP Address: ${responseData.runner_ip_address}`);
|
||||
confg.one_time_key = responseData.one_time_key;
|
||||
addSummary = responseData.monitoring_started ? "true" : "false";
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue