gm-plugkit 2.0.2563 → 2.0.2565

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,6 +52,18 @@ function clearBootstrapError() {
52
52
  } catch (_) {}
53
53
  }
54
54
 
55
+ function failClosedMissingSha(version, artifactName, partialPath) {
56
+ try { fs.unlinkSync(partialPath); } catch (_) {}
57
+ const message = `no sha256 manifest entry for ${artifactName}: refusing to trust unverified download`;
58
+ writeBootstrapError({
59
+ expected_version: version,
60
+ cached_version: null,
61
+ error_phase: 'sha256-manifest-missing',
62
+ error_message: message,
63
+ });
64
+ return new Error(message);
65
+ }
66
+
55
67
  function readVersionFile(wrapperDir) {
56
68
  const p = path.join(wrapperDir, 'plugkit.version');
57
69
  if (!fs.existsSync(p)) throw new Error(`plugkit.version not found at ${p}`);
@@ -226,6 +238,7 @@ module.exports = {
226
238
  resolveProjectRoot,
227
239
  writeBootstrapError,
228
240
  clearBootstrapError,
241
+ failClosedMissingSha,
229
242
  readVersionFile,
230
243
  readShaManifest,
231
244
  copyWasmToGmTools,
package/bootstrap.js CHANGED
@@ -31,6 +31,7 @@ const {
31
31
  writeBootstrapError,
32
32
  clearBootstrapError,
33
33
  resolveInstalledWasmPath,
34
+ failClosedMissingSha,
34
35
  } = core;
35
36
 
36
37
  const LOCK_STALE_MS = 30 * 60 * 1000;
@@ -416,7 +417,8 @@ async function bootstrap(opts) {
416
417
  }
417
418
  }
418
419
 
419
- if (expectedSha) {
420
+ if (!expectedSha) throw failClosedMissingSha(version, wasmName, partialPath);
421
+ {
420
422
  const got = await sha256OfFile(partialPath);
421
423
  if (got !== expectedSha) {
422
424
  try { fs.unlinkSync(partialPath); } catch (_) {}
@@ -428,8 +430,6 @@ async function bootstrap(opts) {
428
430
  throw new Error(`sha256 mismatch for ${wasmName}: expected ${expectedSha}, got ${got}`);
429
431
  }
430
432
  log('sha256 verified');
431
- } else {
432
- log('no sha256 manifest -- skipping verify');
433
433
  }
434
434
 
435
435
  try { fs.renameSync(partialPath, finalPath); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.2563",
3
+ "version": "2.0.2565",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform wasm, verifies SHA256, and launches agentplug-runner (the native wasm host) as the spool watcher daemon.",
5
5
  "main": "index.js",
6
6
  "bin": {