@agentconnect.md/setup 1.37.0-rc.8 → 1.37.0

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.
package/dist/index.js CHANGED
@@ -57107,8 +57107,10 @@ async function describeVaultError(res) {
57107
57107
  }
57108
57108
  //#endregion
57109
57109
  //#region ../control-plane/dist/secrets/vault-transit.js
57110
- /** Transit ciphertext is self-describing: `vault:v<key-version>:<base64>`. */
57111
- const CIPHERTEXT_RE = /^vault:v\d+:/;
57110
+ /** A bare Transit ciphertext what this cipher produced BEFORE scoping existed. */
57111
+ const LEGACY_CIPHERTEXT_RE = /^vault:v\d+:/;
57112
+ /** Any version of our own envelope, including ones this build predates. */
57113
+ const ENVELOPE_RE = /^acv\d+:/;
57112
57114
  var VaultTransitSecretCipher = class {
57113
57115
  http;
57114
57116
  key;
@@ -57143,10 +57145,12 @@ var VaultTransitSecretCipher = class {
57143
57145
  return `${SECRET_ENVELOPE_PREFIX}${data.ciphertext}`;
57144
57146
  }
57145
57147
  async open(stored, scope) {
57146
- const scoped = stored.startsWith(SECRET_ENVELOPE_PREFIX);
57147
- if (!scoped && !CIPHERTEXT_RE.test(stored)) return stored;
57148
- const key = scoped ? this.keyFor(scope) : this.key;
57149
- const ciphertext = scoped ? stored.slice(5) : stored;
57148
+ if (!stored.startsWith("acv1:")) {
57149
+ assertNotUnreadableCiphertext(stored);
57150
+ return stored;
57151
+ }
57152
+ const key = this.keyFor(scope);
57153
+ const ciphertext = stored.slice(5);
57150
57154
  const cacheKey = `${key}\u0000${ciphertext}`;
57151
57155
  const hit = this.openCache.get(cacheKey);
57152
57156
  if (hit !== void 0) return hit;
@@ -57169,6 +57173,17 @@ var VaultTransitSecretCipher = class {
57169
57173
  return (await res.json()).data ?? {};
57170
57174
  }
57171
57175
  };
57176
+ /**
57177
+ * The pass-through arm exists for values that were never sealed (plaintext rows
57178
+ * under `SECRET_CIPHER=none`). It must never swallow a value that IS sealed but
57179
+ * unreadable by this build — returning ciphertext as if it were plaintext is
57180
+ * silent corruption: the caller ships it to a daemon or a platform API as a
57181
+ * credential. Both cases below are loud instead.
57182
+ */
57183
+ function assertNotUnreadableCiphertext(stored) {
57184
+ if (LEGACY_CIPHERTEXT_RE.test(stored)) throw new Error("secret cipher: unscoped legacy ciphertext — run the rewrap sweep on a pre-scoping build first");
57185
+ if (ENVELOPE_RE.test(stored)) throw new Error("secret cipher: stored value uses a newer envelope version than this build supports");
57186
+ }
57172
57187
  //#endregion
57173
57188
  //#region ../control-plane/dist/secrets/cipher.js
57174
57189
  /**
@@ -57190,12 +57205,12 @@ var VaultTransitSecretCipher = class {
57190
57205
  * Contract for an encrypting implementation (e.g. Vault Transit):
57191
57206
  * - `seal` returns a self-describing value carrying the envelope version
57192
57207
  * (`acv1:` + Transit's own `vault:v1:…`).
57193
- * - `open` MUST pass through values it did not seal (no recognizable prefix
57194
- * return as-is): existing plaintext rows keep working, and re-sealing on the
57195
- * next write migrates them lazily — the flip is online, no backfill required.
57196
- * Values sealed before scoping existed (a bare `vault:vN:`) open under the
57197
- * deployment key whatever `scope` says; only the envelope-tagged arm is
57198
- * scoped.
57208
+ * - `open` MUST pass through values it did not seal (no envelope tag return
57209
+ * as-is): existing plaintext rows keep working, and re-sealing on the next
57210
+ * write migrates them lazily — the flip is online, no backfill required. It
57211
+ * must NOT pass through a value that is sealed but unreadable (a pre-scoping
57212
+ * `vault:vN:`, or a newer envelope version) that has to throw, since
57213
+ * returning ciphertext as plaintext would be shipped onward as a credential.
57199
57214
  * - A value sealed under one scope MUST NOT open under another. Failing closed
57200
57215
  * there is the point of passing the scope in.
57201
57216
  * - Neither side ever logs its argument.