diff --git a/action.yml b/action.yml index 37e24fc..9792a32 100644 --- a/action.yml +++ b/action.yml @@ -9,10 +9,6 @@ inputs: description: 'Policy for outbound traffic, can be either audit or block' required: false default: 'block' - expected_checksum: - description: 'Expected sha256 checksum of latest agent.tar.gz file' - default: "a5f466fc5c8a9b809afd421e0f32903da98908feab5a245c734d3775e2e10032" - required: true branding: icon: 'check-square' color: 'green' diff --git a/src/checksum_verify.ts b/src/checksum.ts similarity index 57% rename from src/checksum_verify.ts rename to src/checksum.ts index b609f14..91392e1 100644 --- a/src/checksum_verify.ts +++ b/src/checksum.ts @@ -2,17 +2,16 @@ import * as core from "@actions/core"; import * as crypto from "crypto" import * as fs from "fs" -export function checksumVerify(downloadPath: string){ +export function verifyChecksum(downloadPath: string){ const fileBuffer:Buffer = fs.readFileSync(downloadPath) const checksum: string = crypto.createHash("sha256").update(fileBuffer).digest('hex'); // checksum of downloaded file - const expectedChecksum: string = core.getInput("expected_checksum") // default checksum + const expectedChecksum: string = "a5f466fc5c8a9b809afd421e0f32903da98908feab5a245c734d3775e2e10032" // default checksum if(checksum !== expectedChecksum){ - core.error(`Checksum verification failed.`) - core.setFailed(`Checksum expected ${expectedChecksum} instead got ${checksum}`) + core.setFailed(`Checksum verification failed, expected ${expectedChecksum} instead got ${checksum}`) } core.debug("Checksum verification passed.") diff --git a/src/setup.ts b/src/setup.ts index 4e7675b..fe85560 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -6,7 +6,7 @@ import * as path from "path"; import { v4 as uuidv4 } from "uuid"; import { printInfo } from "./common"; import * as tc from "@actions/tool-cache"; -import {checksumVerify} from "./checksum_verify" +import {verifyChecksum} from "./checksum" (async () => { try { if (process.platform !== "linux") { @@ -57,7 +57,7 @@ import {checksumVerify} from "./checksum_verify" "https://github.com/step-security/agent/releases/download/v0.8.6/agent_0.8.6_linux_amd64.tar.gz" ); - checksumVerify(downloadPath) // NOTE: verifying agent's checksum, before extracting + verifyChecksum(downloadPath) // NOTE: verifying agent's checksum, before extracting const extractPath = await tc.extractTar(downloadPath); console.log(`Step Security Job Correlation ID: ${correlation_id}`);