Skip to content

Commit

Permalink
Merge pull request #399 from h0x0er/debug-mode
Browse files Browse the repository at this point in the history
Add debug mode
  • Loading branch information
varunsh-coder authored Apr 16, 2024
2 parents 3b010fd + 179425f commit d1f044d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 42 deletions.
105 changes: 67 additions & 38 deletions dist/pre/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pre/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/checksum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function verifyChecksum(downloadPath: string, is_tls: boolean) {

if (is_tls) {
expectedChecksum =
"a57efa195b820bd922f3cc8731a6cceff4c7353cb14d89164167cae3e8dbf616"; // checksum for tls_agent
"90b1f823a8ac854b245070c38c0157fa33e7ece385de635bb6caa2f337c259c6"; // checksum for tls_agent
}

if (checksum !== expectedChecksum) {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Configuration {
disable_file_monitoring: boolean;
is_github_hosted: boolean;
private: string;
is_debug: boolean;
}

export interface PolicyResponse {
Expand Down
5 changes: 3 additions & 2 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface MonitorResponse {
disable_file_monitoring: core.getBooleanInput("disable-file-monitoring"),
private: context?.payload?.repository?.private || false,
is_github_hosted: isGithubHosted(),
is_debug: core.isDebug(),
};

let policyName = core.getInput("policy");
Expand Down Expand Up @@ -186,7 +187,7 @@ interface MonitorResponse {
`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`,
monitorRequestData
);

const responseData = resp.result;
statusCode = resp.statusCode; // adding error code to check whether agent is getting installed or not.
fs.appendFileSync(
Expand Down Expand Up @@ -230,7 +231,7 @@ interface MonitorResponse {

if (await isTLSEnabled(context.repo.owner)) {
downloadPath = await tc.downloadTool(
"https://packages.stepsecurity.io/github-hosted/harden-runner_1.1.1_linux_amd64.tar.gz"
"https://packages.stepsecurity.io/github-hosted/harden-runner_1.1.2_linux_amd64.tar.gz"
);
verifyChecksum(downloadPath, true); // NOTE: verifying tls_agent's checksum, before extracting
} else {
Expand Down

0 comments on commit d1f044d

Please sign in to comment.