INNER CODE UNIT · JavaScript

verifySha256

agent-sh/agentsys · lib/binary/index.js:265

function verifySha256(buf, expectedHex, filename) {
  const expected = String(expectedHex || '').toLowerCase();
  const actual = sha256Hex(buf);
  if (expected !== actual) {
    throw new Error(
      'SHA-256 verification failed for ' + filename + ': ' +
      'expected ' + expected + ', got ' + actual + '. ' +
      'This could indicate a tampered release. Do not extract.'
    );
  }
}

// ---------------------------------------------------------------------------
// Archive entry validation
// ---------------------------------------------------------------------------

/**
 * Reject archive entries with paths that could escape the extract directory.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…