Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/thatstupidcomputer / scripts/verify-release.mjs |
| Date | Not specified in source |
| Repository | Janady13/thatstupidcomputer |
| Revision | 57555cde46910102dd25d6c1c1fb2c359e9655bd |
| Branch | main |
| Path or archive member | scripts/verify-release.mjs |
| Original SHA-256 | 578d0f01693dff0427c2e3ec50e80a39b110873386c25cfc89bf7202cd96cf38 |
| Git blob SHA | ef02125505505c05c56ee96c351cf17cb2ce1689 |
| Reading-copy SHA-256 | 578d0f01693dff0427c2e3ec50e80a39b110873386c25cfc89bf7202cd96cf38 |
Recovered source transcript
Download complete source text ↓19 lines · 1.3 KB
import { createHash } from 'node:crypto';
import { readFile, lstat, realpath } from 'node:fs/promises';
import { resolve, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = await realpath(fileURLToPath(new URL('..', import.meta.url)));
const manifest = JSON.parse(await readFile(resolve(root, 'release-manifest.json'), 'utf8'));
if (manifest.schema !== 'tsc-release/v1' || !Array.isArray(manifest.files)) throw new Error('Invalid release manifest.');
const seen = new Set();
for (const item of manifest.files) {
if (typeof item.path !== 'string' || item.path.startsWith('/') || item.path.split('/').some(part => !part || part === '.' || part === '..') || item.path.includes('\\') || seen.has(item.path)) throw new Error('Invalid manifest path.');
seen.add(item.path);
const path = resolve(root, item.path);
if (!(await realpath(path)).startsWith(root + sep) || !(await lstat(path)).isFile()) throw new Error(`Unsafe release entry: ${item.path}`);
const bytes = await readFile(path);
if (bytes.length !== item.bytes || createHash('sha256').update(bytes).digest('hex') !== item.sha256) throw new Error(`Release integrity failed: ${item.path}`);
}
console.log(`Verified ${seen.size} delivered files against the release manifest. This checks transfer integrity, not production acceptance.`);