@batalabs/virlow-mcp-core 3.14.3 → 3.14.4

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.
@@ -29,6 +29,41 @@ export declare class Vault {
29
29
  };
30
30
  touch(): void;
31
31
  get session(): UnlockedSession;
32
+ /**
33
+ * The largest delay `setTimeout` can actually hold: a 32-bit signed integer
34
+ * of milliseconds, about 24.9 days.
35
+ */
36
+ private static readonly MAX_TIMEOUT_MS;
37
+ /**
38
+ * Arm the auto-lock, unless the configured delay cannot be one.
39
+ *
40
+ * The guard is the whole point. `setTimeout` does not treat an out-of-range
41
+ * delay as "later" or as an error — it coerces it to **1 millisecond** and
42
+ * fires:
43
+ *
44
+ * TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed
45
+ * integer. Timeout duration was set to 1.
46
+ *
47
+ * So `new Vault(Number.POSITIVE_INFINITY)`, which reads as "never auto-lock,
48
+ * something else owns the timeout", locked the vault a millisecond after
49
+ * every unlock and every touch. The hosted connector is built exactly that
50
+ * way — its session store owns the idle timeout — and the result was a vault
51
+ * that reported itself unlocked on the request that opened it and locked on
52
+ * every request after:
53
+ *
54
+ * status -> {"locked": false, "email": "..."}
55
+ * list_folders -> "Vault is locked." (2 seconds later, same session)
56
+ *
57
+ * Nothing in the store was wrong, which is what made it so hard to see: the
58
+ * session was found on every request, and the vault built from it had already
59
+ * locked itself. touch() re-armed the same 1ms timer, so activity made it
60
+ * worse rather than better.
61
+ *
62
+ * A delay that cannot be scheduled therefore means no auto-lock at all, which
63
+ * is what every caller passing one intends. Zero and negatives are the same
64
+ * case — a vault that locks on the next tick is not a security posture, it is
65
+ * a broken one — and a caller wanting an immediate lock has `lock()`.
66
+ */
32
67
  private _scheduleAutoLock;
33
68
  private _clearTimer;
34
69
  }
package/dist/cjs/vault.js CHANGED
@@ -61,10 +61,50 @@ class Vault {
61
61
  }
62
62
  return this._session;
63
63
  }
64
+ /**
65
+ * The largest delay `setTimeout` can actually hold: a 32-bit signed integer
66
+ * of milliseconds, about 24.9 days.
67
+ */
68
+ static MAX_TIMEOUT_MS = 2_147_483_647;
69
+ /**
70
+ * Arm the auto-lock, unless the configured delay cannot be one.
71
+ *
72
+ * The guard is the whole point. `setTimeout` does not treat an out-of-range
73
+ * delay as "later" or as an error — it coerces it to **1 millisecond** and
74
+ * fires:
75
+ *
76
+ * TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed
77
+ * integer. Timeout duration was set to 1.
78
+ *
79
+ * So `new Vault(Number.POSITIVE_INFINITY)`, which reads as "never auto-lock,
80
+ * something else owns the timeout", locked the vault a millisecond after
81
+ * every unlock and every touch. The hosted connector is built exactly that
82
+ * way — its session store owns the idle timeout — and the result was a vault
83
+ * that reported itself unlocked on the request that opened it and locked on
84
+ * every request after:
85
+ *
86
+ * status -> {"locked": false, "email": "..."}
87
+ * list_folders -> "Vault is locked." (2 seconds later, same session)
88
+ *
89
+ * Nothing in the store was wrong, which is what made it so hard to see: the
90
+ * session was found on every request, and the vault built from it had already
91
+ * locked itself. touch() re-armed the same 1ms timer, so activity made it
92
+ * worse rather than better.
93
+ *
94
+ * A delay that cannot be scheduled therefore means no auto-lock at all, which
95
+ * is what every caller passing one intends. Zero and negatives are the same
96
+ * case — a vault that locks on the next tick is not a security posture, it is
97
+ * a broken one — and a caller wanting an immediate lock has `lock()`.
98
+ */
64
99
  _scheduleAutoLock() {
100
+ const ms = this.autoLockMs;
101
+ if (!Number.isFinite(ms) || ms <= 0 || ms > Vault.MAX_TIMEOUT_MS) {
102
+ this._timerHandle = null;
103
+ return;
104
+ }
65
105
  this._timerHandle = setTimeout(() => {
66
106
  this.lock();
67
- }, this.autoLockMs);
107
+ }, ms);
68
108
  this._timerHandle.unref?.();
69
109
  }
70
110
  _clearTimer() {
package/dist/vault.d.ts CHANGED
@@ -29,6 +29,41 @@ export declare class Vault {
29
29
  };
30
30
  touch(): void;
31
31
  get session(): UnlockedSession;
32
+ /**
33
+ * The largest delay `setTimeout` can actually hold: a 32-bit signed integer
34
+ * of milliseconds, about 24.9 days.
35
+ */
36
+ private static readonly MAX_TIMEOUT_MS;
37
+ /**
38
+ * Arm the auto-lock, unless the configured delay cannot be one.
39
+ *
40
+ * The guard is the whole point. `setTimeout` does not treat an out-of-range
41
+ * delay as "later" or as an error — it coerces it to **1 millisecond** and
42
+ * fires:
43
+ *
44
+ * TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed
45
+ * integer. Timeout duration was set to 1.
46
+ *
47
+ * So `new Vault(Number.POSITIVE_INFINITY)`, which reads as "never auto-lock,
48
+ * something else owns the timeout", locked the vault a millisecond after
49
+ * every unlock and every touch. The hosted connector is built exactly that
50
+ * way — its session store owns the idle timeout — and the result was a vault
51
+ * that reported itself unlocked on the request that opened it and locked on
52
+ * every request after:
53
+ *
54
+ * status -> {"locked": false, "email": "..."}
55
+ * list_folders -> "Vault is locked." (2 seconds later, same session)
56
+ *
57
+ * Nothing in the store was wrong, which is what made it so hard to see: the
58
+ * session was found on every request, and the vault built from it had already
59
+ * locked itself. touch() re-armed the same 1ms timer, so activity made it
60
+ * worse rather than better.
61
+ *
62
+ * A delay that cannot be scheduled therefore means no auto-lock at all, which
63
+ * is what every caller passing one intends. Zero and negatives are the same
64
+ * case — a vault that locks on the next tick is not a security posture, it is
65
+ * a broken one — and a caller wanting an immediate lock has `lock()`.
66
+ */
32
67
  private _scheduleAutoLock;
33
68
  private _clearTimer;
34
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAEzC,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,KAAK;IAUJ,OAAO,CAAC,QAAQ,CAAC,UAAU;IATvC,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO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AAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAO7C,KAAK,IAAI,IAAI;IAQb,IAAI,OAAO,IAAI,eAAe,CAO7B;IAED;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,WAAW;CAMpB"}
package/dist/vault.js CHANGED
@@ -57,10 +57,50 @@ export class Vault {
57
57
  }
58
58
  return this._session;
59
59
  }
60
+ /**
61
+ * The largest delay `setTimeout` can actually hold: a 32-bit signed integer
62
+ * of milliseconds, about 24.9 days.
63
+ */
64
+ static MAX_TIMEOUT_MS = 2_147_483_647;
65
+ /**
66
+ * Arm the auto-lock, unless the configured delay cannot be one.
67
+ *
68
+ * The guard is the whole point. `setTimeout` does not treat an out-of-range
69
+ * delay as "later" or as an error — it coerces it to **1 millisecond** and
70
+ * fires:
71
+ *
72
+ * TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed
73
+ * integer. Timeout duration was set to 1.
74
+ *
75
+ * So `new Vault(Number.POSITIVE_INFINITY)`, which reads as "never auto-lock,
76
+ * something else owns the timeout", locked the vault a millisecond after
77
+ * every unlock and every touch. The hosted connector is built exactly that
78
+ * way — its session store owns the idle timeout — and the result was a vault
79
+ * that reported itself unlocked on the request that opened it and locked on
80
+ * every request after:
81
+ *
82
+ * status -> {"locked": false, "email": "..."}
83
+ * list_folders -> "Vault is locked." (2 seconds later, same session)
84
+ *
85
+ * Nothing in the store was wrong, which is what made it so hard to see: the
86
+ * session was found on every request, and the vault built from it had already
87
+ * locked itself. touch() re-armed the same 1ms timer, so activity made it
88
+ * worse rather than better.
89
+ *
90
+ * A delay that cannot be scheduled therefore means no auto-lock at all, which
91
+ * is what every caller passing one intends. Zero and negatives are the same
92
+ * case — a vault that locks on the next tick is not a security posture, it is
93
+ * a broken one — and a caller wanting an immediate lock has `lock()`.
94
+ */
60
95
  _scheduleAutoLock() {
96
+ const ms = this.autoLockMs;
97
+ if (!Number.isFinite(ms) || ms <= 0 || ms > Vault.MAX_TIMEOUT_MS) {
98
+ this._timerHandle = null;
99
+ return;
100
+ }
61
101
  this._timerHandle = setTimeout(() => {
62
102
  this.lock();
63
- }, this.autoLockMs);
103
+ }, ms);
64
104
  this._timerHandle.unref?.();
65
105
  }
66
106
  _clearTimer() {
package/dist/vault.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;CAAG;AAQzC,MAAM,OAAO,KAAK;IAUa;IATrB,QAAQ,GAA2B,IAAI,CAAC;IACxC,YAAY,GAA0B,IAAI,CAAC;IAEnD;;;qCAGiC;IACzB,aAAa,GAAsB,EAAE,CAAC;IAE9C,YAA6B,aAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;QAAvC,eAAU,GAAV,UAAU,CAA6B;IAAG,CAAC;IAExE;;yBAEqB;IACrB,IAAI,MAAM,CAAC,EAAc;QACvB,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,EAAc;QAC5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,OAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,CAAC,6BAA6B;QACvC,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAC1C,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AI,EAAE,CAAC;YAC3B,OAAO,CAAC,yBAAyB;QACnC,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO;QACT,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,MAAM,IAAI,WAAW,CACnB,gGAAgG,CACjG,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;OAGG;IACK,MAAM,CAAU,cAAc,GAAG,aAAa,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACK,iBAAiB;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;YACjE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;YAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9B,CAAC;IAEO,WAAW;QACjB,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YAC/B,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batalabs/virlow-mcp-core",
3
- "version": "3.14.3",
3
+ "version": "3.14.4",
4
4
  "type": "module",
5
5
  "description": "Virlow MCP connector core: encrypted note and memory access, folder exposure, and the memories opt-in. Shared by the local virlow-mcp CLI and the hosted connector.",
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@
26
26
  "@modelcontextprotocol/sdk": "^1.12.0",
27
27
  "yaml": ">=2.8.3 <3",
28
28
  "zod": "^3.24.0",
29
- "@batalabs/virlow-memory": "3.14.3",
30
- "@batalabs/virlow-crypto": "3.14.3"
29
+ "@batalabs/virlow-crypto": "3.14.4",
30
+ "@batalabs/virlow-memory": "3.14.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.10.0",