instar 1.3.265 → 1.3.267

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAi9QtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAi+QtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -9191,8 +9191,15 @@ export async function startServer(options) {
9191
9191
  // by the mesh acceptance layer before this runs; confidentiality is enforced by the
9192
9192
  // decryption (a payload not sealed to our key fails). The OUTBOUND provisioner is wired
9193
9193
  // after the MeshRpcClient is constructed (below).
9194
- const _secretSyncEnabled = config.multiMachine?.secretSync?.enabled
9195
- ?? !!config.developmentAgent;
9194
+ const _secretSyncCfg = config.multiMachine?.secretSync;
9195
+ const _secretSyncEnabled = _secretSyncCfg?.enabled ?? !!config.developmentAgent;
9196
+ // SAFETY: pushing is opt-in SEPARATELY from receiving and DEFAULTS OFF. A machine
9197
+ // whose local secret store is stale/divergent (e.g. recovered from a key drift) would
9198
+ // otherwise auto-push its stale set to peers on boot and CLOBBER their good secrets —
9199
+ // the exact corruption class this guard prevents. So `enabled` alone = RECEIVE-ONLY;
9200
+ // outbound (boot best-effort + POST /secrets/sync-now) requires `pushEnabled: true`,
9201
+ // which you set only on the machine whose store is authoritative.
9202
+ const _secretSyncPushEnabled = _secretSyncEnabled && (_secretSyncCfg?.pushEnabled ?? false);
9196
9203
  let _secretShareHandler;
9197
9204
  if (_secretSyncEnabled) {
9198
9205
  try {
@@ -9379,16 +9386,26 @@ export async function startServer(options) {
9379
9386
  });
9380
9387
  _secretSyncHandle = {
9381
9388
  enabled: true,
9382
- provisionAll: () => provisioner.provisionAll(),
9389
+ pushEnabled: _secretSyncPushEnabled,
9390
+ // Outbound is gated on pushEnabled: a receive-only machine NEVER pushes its
9391
+ // (possibly stale) set to peers. The route surfaces a clear refusal instead.
9392
+ provisionAll: () => _secretSyncPushEnabled
9393
+ ? provisioner.provisionAll()
9394
+ : Promise.resolve([]),
9383
9395
  localKeyPaths: () => secretSyncMod.secretKeyPaths(readSecrets()),
9384
9396
  syncTargets: onlinePeers,
9385
9397
  };
9386
- // Boot best-effort: push current secrets to any peer already online.
9387
- // @silent-fallback-ok — fire-and-forget; per-peer failures are already captured
9388
- // in provisionAll's result array, and a fresh push fires on the next provision /
9389
- // the deterministic POST /secrets/sync-now. Boot must never block on a peer.
9390
- void provisioner.provisionAll().catch(() => { });
9391
- console.log(pc.dim(' [secret-sync] enabled — outbound provisioner wired'));
9398
+ if (_secretSyncPushEnabled) {
9399
+ // Boot best-effort: push current secrets to any peer already online.
9400
+ // @silent-fallback-ok — fire-and-forget; per-peer failures are already captured
9401
+ // in provisionAll's result array, and a fresh push fires on the next provision /
9402
+ // the deterministic POST /secrets/sync-now. Boot must never block on a peer.
9403
+ void provisioner.provisionAll().catch(() => { });
9404
+ console.log(pc.dim(' [secret-sync] enabled — outbound provisioner wired (push ON)'));
9405
+ }
9406
+ else {
9407
+ console.log(pc.dim(' [secret-sync] enabled — RECEIVE-ONLY (push disabled; set multiMachine.secretSync.pushEnabled=true on the authoritative machine to push)'));
9408
+ }
9392
9409
  }
9393
9410
  catch (err) {
9394
9411
  console.log(pc.dim(` [secret-sync] outbound provisioner not wired: ${err instanceof Error ? err.message : String(err)}`));