@cosmicdrift/kumiko-framework 0.149.0 → 0.149.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-framework",
3
- "version": "0.149.0",
3
+ "version": "0.149.2",
4
4
  "description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -193,7 +193,7 @@
193
193
  "zod": "^4.4.3"
194
194
  },
195
195
  "devDependencies": {
196
- "@cosmicdrift/kumiko-dispatcher-live": "0.149.0",
196
+ "@cosmicdrift/kumiko-dispatcher-live": "0.149.2",
197
197
  "bun-types": "^1.3.13",
198
198
  "pino-pretty": "^13.1.3"
199
199
  },
@@ -271,15 +271,22 @@ export function buildExecutorContext(
271
271
  return out;
272
272
  }
273
273
 
274
+ // Mirror of encryptForStorage IN REVERSE — a field that carries both
275
+ // `encrypted: true` and a subject marker (userOwned/tenantOwned/pii) is
276
+ // written as PII(envelope(plaintext)) (envelope wraps first, PII wraps
277
+ // that as its outer layer). Decrypt must peel the OUTER layer first: PII
278
+ // unwrap before envelope decrypt, or the envelope cipher chokes on a
279
+ // still-PII-wrapped string (auth-mfa.totpSecret/recoveryCodes combine both
280
+ // markers; see pii-subject-encryption.integration.test.ts).
274
281
  async function decryptForRead(row: Record<string, unknown>): Promise<Record<string, unknown>> {
275
282
  let out = row;
276
- if (hasEncryptedFields) {
277
- out = await decryptEntityFieldValues(out, encryptedFields, fieldCipher());
278
- }
279
283
  const kms = piiKms();
280
284
  if (hasPiiFields && kms) {
281
285
  out = await decryptPiiFieldValues(out, piiSubjectFields, kms, kmsContextFor());
282
286
  }
287
+ if (hasEncryptedFields) {
288
+ out = await decryptEntityFieldValues(out, encryptedFields, fieldCipher());
289
+ }
283
290
  return out;
284
291
  }
285
292