@conarium-ai/core 0.2.37 → 0.2.39

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +6 -5
  3. package/bin/conarium-coverage.mjs +20 -19
  4. package/bin/conarium-init.mjs +10 -9
  5. package/bin/conarium-reconcile.mjs +6 -6
  6. package/bin/conarium-verify.mjs +37 -33
  7. package/dist/audit-hash.d.ts +1 -1
  8. package/dist/audit-hash.d.ts.map +1 -1
  9. package/dist/audit-hash.js +1 -1
  10. package/dist/audit-hash.js.map +1 -1
  11. package/dist/audit.d.ts +22 -21
  12. package/dist/audit.d.ts.map +1 -1
  13. package/dist/audit.js +104 -88
  14. package/dist/audit.js.map +1 -1
  15. package/dist/config.d.ts +69 -433
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/config.js +7 -4
  18. package/dist/config.js.map +1 -1
  19. package/dist/connectors/supabase_rest.d.ts +2 -2
  20. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  21. package/dist/connectors/supabase_rest.js +7 -5
  22. package/dist/connectors/supabase_rest.js.map +1 -1
  23. package/dist/console-receipts.d.ts +2 -2
  24. package/dist/console-receipts.d.ts.map +1 -1
  25. package/dist/console-receipts.js +2 -2
  26. package/dist/console-receipts.js.map +1 -1
  27. package/dist/console.d.ts +6 -22
  28. package/dist/console.d.ts.map +1 -1
  29. package/dist/console.js +13 -12
  30. package/dist/console.js.map +1 -1
  31. package/dist/coverage.d.ts +32 -30
  32. package/dist/coverage.d.ts.map +1 -1
  33. package/dist/coverage.js +39 -36
  34. package/dist/coverage.js.map +1 -1
  35. package/dist/governance.d.ts +14 -13
  36. package/dist/governance.d.ts.map +1 -1
  37. package/dist/governance.js +52 -48
  38. package/dist/governance.js.map +1 -1
  39. package/dist/http.d.ts +6 -5
  40. package/dist/http.d.ts.map +1 -1
  41. package/dist/http.js +45 -41
  42. package/dist/http.js.map +1 -1
  43. package/dist/iban.d.ts.map +1 -1
  44. package/dist/iban.js +13 -12
  45. package/dist/iban.js.map +1 -1
  46. package/dist/llm-gate.d.ts +6 -6
  47. package/dist/llm-gate.js +6 -6
  48. package/dist/pseudonymize.d.ts +8 -8
  49. package/dist/pseudonymize.d.ts.map +1 -1
  50. package/dist/pseudonymize.js +7 -7
  51. package/dist/pseudonymize.js.map +1 -1
  52. package/dist/receipt-view.d.ts +1 -1
  53. package/dist/receipt-view.d.ts.map +1 -1
  54. package/dist/receipt-view.js +52 -51
  55. package/dist/receipt-view.js.map +1 -1
  56. package/dist/receipt.d.ts +32 -28
  57. package/dist/receipt.d.ts.map +1 -1
  58. package/dist/receipt.js +23 -20
  59. package/dist/receipt.js.map +1 -1
  60. package/dist/scripts/discover_schema.js +14 -12
  61. package/dist/scripts/discover_schema.js.map +1 -1
  62. package/dist/scripts/dogfood_prove.js +16 -16
  63. package/dist/scripts/dogfood_prove.js.map +1 -1
  64. package/dist/server.d.ts +5 -4
  65. package/dist/server.d.ts.map +1 -1
  66. package/dist/server.js +44 -34
  67. package/dist/server.js.map +1 -1
  68. package/dist/sql-gate/rules.d.ts +8 -7
  69. package/dist/sql-gate/rules.d.ts.map +1 -1
  70. package/dist/sql-gate/rules.js +11 -9
  71. package/dist/sql-gate/rules.js.map +1 -1
  72. package/dist/tokens.d.ts +3 -3
  73. package/dist/tokens.d.ts.map +1 -1
  74. package/dist/tokens.js +18 -18
  75. package/dist/tokens.js.map +1 -1
  76. package/docs/RECEIPT-SPEC.md +188 -1
  77. package/docs/claims/reviews/0.2.38.md +58 -0
  78. package/docs/claims/reviews/0.2.39.md +90 -0
  79. package/docs/security/THREAT-MODEL.md +6 -1
  80. package/package.json +6 -4
  81. package/public/app.js +6 -6
  82. package/public/index.html +7 -7
  83. package/public/receipts-panel.js +7 -7
  84. package/scripts/audit-chain-check.mjs +6 -6
  85. package/scripts/benchmark-overhead.mjs +4 -4
  86. package/scripts/conarium_sabah_brief.mjs +11 -11
  87. package/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,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,GAAG,SAAS,CASpB;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyCpD"}
@@ -36,14 +36,15 @@ export const SAFE_BUILTIN_FUNCTIONS = new Set([
36
36
  'upper',
37
37
  ]);
38
38
  /**
39
- * Lehçeye özgü skaler fonksiyonlar. Ortak liste Postgres adlarını taşır; MSSQL ve
40
- * Oracle kapıları da o listeye bağlanınca `GETDATE`/`NVL` gibi en sıradan çağrılar
41
- * reddedilir hâle gelmişti — açık kapanırken meşru kullanım kırılıyordu.
39
+ * Dialect-specific scalar functions. The shared list carries Postgres names; once
40
+ * the MSSQL and Oracle gates bound to that list, the most ordinary calls like
41
+ * `GETDATE`/`NVL` started being rejected — the gate closed while legitimate use
42
+ * broke.
42
43
  *
43
- * Kural: buraya YALNIZ saf, okuma amaçlı, satır sayısını değiştirmeyen skaler
44
- * dönüşümler girer. Satır toplayan/serileştiren her şey BLOCKED_DUMP_FUNCTIONS'ın
45
- * işidir; dinamik SQL üreten, dosya/ağ/OS'a uzanan aileler (DBMS_*, UTL_*, xp_*,
46
- * sp_*, OPENROWSET/OPENJSON) hiçbir koşulda buraya yazılmaz.
44
+ * Rule: only pure, read-oriented scalar transforms that do not change row count
45
+ * go here. Anything that aggregates/serializes rows is BLOCKED_DUMP_FUNCTIONS'
46
+ * job; families that produce dynamic SQL or reach file/network/OS (DBMS_*, UTL_*,
47
+ * xp_*, sp_*, OPENROWSET/OPENJSON) must never be written here.
47
48
  */
48
49
  export const DIALECT_SAFE_FUNCTIONS = {
49
50
  mssql: new Set([
@@ -109,8 +110,9 @@ export function hasRowLockClause(norm) {
109
110
  export function isSafeBuiltinFunction(baseName, schema, dialect) {
110
111
  if (SAFE_BUILTIN_FUNCTIONS.has(baseName) && (!schema || schema === 'pg_catalog'))
111
112
  return true;
112
- // Lehçe listesi YALNIZ şemasız çağrıyı karşılar: `app.pkg.nvl` kullanıcı paketidir,
113
- // yerleşik değil — şema niteleyicisi varsa lehçe listesi devreye girmez.
113
+ // The dialect list covers ONLY un-schema-qualified calls: `app.pkg.nvl` is a
114
+ // user package, not a builtin — if a schema qualifier is present the dialect
115
+ // list does not apply.
114
116
  if (schema)
115
117
  return false;
116
118
  if (dialect === 'mssql' || dialect === 'oracle') {
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/sql-gate/rules.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS;IAC1E,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS;CACzD,CAAA;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,SAAS;IACT,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,QAAQ;IACR,cAAc;IACd,gBAAgB;IAChB,uBAAuB;IACvB,SAAS;IACT,OAAO;IACP,OAAO;IACP,YAAY;IACZ,KAAK;IACL,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAoD;IACrF,KAAK,EAAE,IAAI,GAAG,CAAC;QACb,WAAW;QACX,SAAS;QACT,SAAS;QACT,UAAU;QACV,UAAU;QACV,SAAS;QACT,QAAQ;QACR,MAAM;QAC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,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;gBAAE,CAAC,IAAI,CAAC,CAAA;YACxE,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM;gBAAE,CAAC,IAAI,CAAC,CAAA;YAC1B,GAAG,IAAI,GAAG,CAAA;YACV,SAAQ;QACV,CAAC;QACD,GAAG,IAAI,CAAC,CAAA;QACR,CAAC,IAAI,CAAC,CAAA;IACR,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
package/dist/tokens.d.ts CHANGED
@@ -4,11 +4,11 @@ export interface ResolvedActor {
4
4
  assurance: ActorAssurance;
5
5
  isUser: boolean;
6
6
  }
7
- /** karma → kişi id. Dosya yoksa null = kişi bazlı kimlik kapalı (hata değil). */
7
+ /** hash → person id. If the file is missing, null = per-person identity is off (not an error). */
8
8
  export declare function loadTokenStore(path?: string): Map<string, string> | null;
9
9
  /**
10
- * Gelen token'ı kişiye çözer. Eşleşme yoksa ASLA kişi kimliği üretmez —
11
- * paylaşılan token davranışına düşer.
10
+ * Resolves the incoming token to a person. If there is no match it NEVER
11
+ * invents a person identity — it falls back to shared-token behavior.
12
12
  */
13
13
  export declare function resolveActor(supplied: string, store: Map<string, string> | null, fallbackId: string): ResolvedActor;
14
14
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,cAAc,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAChB;AAYD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkBzF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,GACjB,aAAa,CAOf"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,cAAc,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAChB;AAYD,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkBzF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,GACjB,aAAa,CAOf"}
package/dist/tokens.js CHANGED
@@ -1,26 +1,26 @@
1
1
  /**
2
- * Kişi bazlı kimlik — token deposu.
2
+ * Per-person identity — token store.
3
3
  *
4
- * Neden beyan değil token: istemcinin gönderdiği isim (X-Conarium-Actor gibi)
5
- * kimse tarafından doğrulanmamıştır; onu imzalayıp makbuza yazmak, dürüst
6
- * 'service' değerinden kötüdür. Token'ı Conarium zaten doğruluyor, dolayısıyla
7
- * kimin bağlandığını BİLİR.
4
+ * Why a token, not a declaration: a name the client sends (such as
5
+ * X-Conarium-Actor) has not been verified by anyone; signing it onto the
6
+ * receipt is worse than an honest 'service' value. Conarium already verifies
7
+ * the token, so it KNOWS who connected.
8
8
  *
9
- * Token'lar düz metin saklanmaz — yalnızca SHA-256 karması. Dosya sızsa bile
10
- * kimsenin token'ı ele geçmez.
9
+ * Tokens are not stored in plaintext — only a SHA-256 hash. Even if the
10
+ * file leaks, nobody's token is captured.
11
11
  */
12
12
  import { createHash } from 'node:crypto';
13
13
  import { existsSync, readFileSync } from 'node:fs';
14
14
  /**
15
- * Yol her çağrıda okunur, modül yüklenirken DEĞİL.
16
- * Sabit olarak yakalansaydı `CONARIUM_TOKENS_FILE`'ı sonradan değiştirmek
17
- * hiçbir şeyi etkilemezdi — testler dahil, ki bu sessizce yanlış şeyi ölçmek
18
- * demek olurdu.
15
+ * The path is read on every call, NOT at module load.
16
+ * If it were captured as a constant, changing `CONARIUM_TOKENS_FILE`
17
+ * afterwards would affect nothing — including tests, which would silently
18
+ * measure the wrong thing.
19
19
  */
20
20
  function varsayilanYol() {
21
21
  return process.env.CONARIUM_TOKENS_FILE || 'conarium.tokens.json';
22
22
  }
23
- /** karma → kişi id. Dosya yoksa null = kişi bazlı kimlik kapalı (hata değil). */
23
+ /** hash → person id. If the file is missing, null = per-person identity is off (not an error). */
24
24
  export function loadTokenStore(path = varsayilanYol()) {
25
25
  if (!existsSync(path))
26
26
  return null;
@@ -29,10 +29,10 @@ export function loadTokenStore(path = varsayilanYol()) {
29
29
  raw = JSON.parse(readFileSync(path, 'utf8'));
30
30
  }
31
31
  catch (e) {
32
- // Bilerek FIRLATIYORUZ, sessizce null dönmüyoruz: null dönmek kişi bazlı
33
- // kimliği fark edilmeden kapatır ve herkes yeniden 'service' olur —
34
- // sessiz düşüş, gürültülü hatadan çok daha tehlikelidir.
35
- throw new Error(`loadTokenStore: ${path} okunamadı/bozuk JSON — ${e.message}`);
32
+ // We THROW on purpose, we do not silently return null: returning null
33
+ // would turn off per-person identity unnoticed and everyone would become
34
+ // 'service' again — a silent drop is far more dangerous than a noisy error.
35
+ throw new Error(`loadTokenStore: ${path} unreadable or invalid JSON — ${e.message}`);
36
36
  }
37
37
  const map = new Map();
38
38
  for (const t of raw.tokens ?? []) {
@@ -43,8 +43,8 @@ export function loadTokenStore(path = varsayilanYol()) {
43
43
  return map;
44
44
  }
45
45
  /**
46
- * Gelen token'ı kişiye çözer. Eşleşme yoksa ASLA kişi kimliği üretmez —
47
- * paylaşılan token davranışına düşer.
46
+ * Resolves the incoming token to a person. If there is no match it NEVER
47
+ * invents a person identity — it falls back to shared-token behavior.
48
48
  */
49
49
  export function resolveActor(supplied, store, fallbackId) {
50
50
  if (store && supplied) {
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAUlD;;;;;GAKG;AACH,SAAS,aAAa;IACpB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,sBAAsB,CAAA;AACnE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,IAAI,GAAW,aAAa,EAAE;IAC3D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,GAAoD,CAAA;IACxD,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,yEAAyE;QACzE,oEAAoE;QACpE,yDAAyD;QACzD,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,2BAA4B,CAAW,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;IACrC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,EAAE,K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AAE,CAAA;AACrE,CAAC"}
@@ -207,10 +207,197 @@ block-explorer client in this repository; `ignoreBitcoinNode: true` is set.
207
207
  Tracked remainder: unclassified network-shaped errors still share 14 with
208
208
  "proof does not hold".
209
209
 
210
+ ## Wire format for a second implementation
211
+
212
+ An independent implementer built a verifier from the published vectors and the
213
+ IETF draft alone. They reached 13/13 — but only after opening this repository's
214
+ source, because four things were nowhere in the documents: what the signature
215
+ actually covers, that `seq` must advance by exactly one, which absent fields are
216
+ schema errors rather than hash mismatches, and in what order the checks run.
217
+ A specification that has to be read alongside its own implementation is not
218
+ finished. What they had to guess is written down below.
219
+
220
+ Parts of this section are asserted against the shipped verifier by
221
+ `test/spec_wire_contract.mjs` and are marked **measured** where they appear:
222
+ the signed payload and its byte length, the order the checks run in, the
223
+ required-field table row by row, and the vector counts quoted in prose. If the
224
+ code moves and one of those sentences does not, the check fails.
225
+
226
+ The rest of this section is prose. It describes behaviour the verifier has, and
227
+ nothing in the test suite compares it to the code — the same gap the
228
+ Implementation Status guard was written to close one document over. Read it as
229
+ accurate on the revision that shipped it, not as pinned.
230
+
231
+ ### What the signature covers — measured
232
+
233
+ `sig.value` is base64 of an Ed25519 signature over the **UTF-8 bytes of the
234
+ `chain.hash` string, `sha256:` prefix included** — 71 bytes for a SHA-256
235
+ digest (`sha256:` plus 64 hex characters).
236
+
237
+ It is not the raw 32-byte digest, not the hex without the prefix, and not the
238
+ canonical JSON of the receipt. Those are the three natural guesses, and the
239
+ guard verifies that a correct signature fails against all three: an
240
+ implementation that picks one of them produces receipts nobody else can check,
241
+ and discovers this only when a second party tries.
242
+
243
+ ```
244
+ payload = utf8("sha256:" + hex(SHA-256(canonical bytes))) # 71 bytes
245
+ sig.value = base64(Ed25519-sign(payload))
246
+ ```
247
+
248
+ The three paragraphs that follow are prose, not measured. `sig.alg` is
249
+ `Ed25519` — any other value is rejected before the key is loaded.
250
+ `sig.keyId` selects the public key from the caller's trust set; an unknown
251
+ `keyId` is a signature failure, not a "skip". `sig.value` must be canonical
252
+ base64: a re-encodable variant is refused rather than normalised.
253
+
254
+ The signature covers the hash, and the hash covers the receipt. `hash`, `sig`
255
+ and `anchor` are excluded from the bytes that are hashed — which is what lets a
256
+ transparency-log anchor be attached after signing, and is also the limit
257
+ recorded under **Known gaps**.
258
+
259
+ ### `seq` advances by exactly one
260
+
261
+ **Measured:** that a gap yields exit 12, and that it is diagnosed before the
262
+ signature check. **Not measured:** the non-increasing case and
263
+ `--expect-seq-from`, which no vector exercises — stated here rather than left
264
+ to be discovered.
265
+
266
+ `chain.seq` is an integer that increases by **exactly one** between consecutive
267
+ receipts. Both failure shapes are exit **12**:
268
+
269
+ - `seq` not greater than its predecessor — reordered or duplicated;
270
+ - `seq` greater by more than one — a receipt is missing.
271
+
272
+ `prevHash` alone does not catch the second case. A chain with a deleted receipt
273
+ can still link correctly if the deletion happened before the successors were
274
+ written; only the counter reveals the hole. That is what vector
275
+ `005-seq-gap` is for, and a verifier that checks hashes but not `seq` passes it
276
+ and is wrong.
277
+
278
+ `--expect-seq-from N` pins the first receipt of the file to `N`. Without it, a
279
+ file whose first receipt is `seq: 7` verifies as a valid *suffix* — the
280
+ verifier reports what it can prove, and where a chain starts is not something a
281
+ single file can prove.
282
+
283
+ ### Fields whose absence is a schema error (exit 20) — measured
284
+
285
+ A receipt missing one of these is not a tampered receipt — it is not a receipt.
286
+ The distinction matters because the exit code is a diagnosis: reporting exit 10
287
+ ("record altered") for a document that never had the field would name the wrong
288
+ event.
289
+
290
+ Each row is checked by removing exactly that path from the named vector and
291
+ requiring exit 20.
292
+
293
+ | Path | Checked against |
294
+ |---|---|
295
+ | `v` | 001-single-receipt |
296
+ | `id` | 001-single-receipt |
297
+ | `ts` | 001-single-receipt |
298
+ | `period` | 001-single-receipt |
299
+ | `request` | 001-single-receipt |
300
+ | `dataRefs` | 001-single-receipt |
301
+ | `policy` | 001-single-receipt |
302
+ | `policy.decision` | 001-single-receipt |
303
+ | `flags` | 001-single-receipt |
304
+ | `masking` | 001-single-receipt |
305
+ | `outcome` | 001-single-receipt |
306
+ | `actor` | 001-single-receipt |
307
+ | `actor.type` | 001-single-receipt |
308
+ | `actor.assurance` | 001-single-receipt |
309
+ | `chain` | 001-single-receipt |
310
+ | `chain.seq` | 001-single-receipt |
311
+ | `chain.prevHash` | 001-single-receipt |
312
+ | `chain.hash` | 001-single-receipt |
313
+ | `consentRef` | 001-single-receipt |
314
+ | `anchor` | 001-single-receipt |
315
+ | `model` | 001-single-receipt |
316
+ | `model.source` | 001-single-receipt |
317
+ | `client` | 001-single-receipt |
318
+ | `client.source` | 001-single-receipt |
319
+ | `disclosure` | 010-disclosure-commitment |
320
+ | `disclosure.source` | 010-disclosure-commitment |
321
+ | `disclosure.hash` | 010-disclosure-commitment |
322
+ | `disclosure.bytes` | 010-disclosure-commitment |
323
+ | `destination` | 010-disclosure-commitment |
324
+ | `destination.source` | 010-disclosure-commitment |
325
+ | `destination.value` | 010-disclosure-commitment |
326
+
327
+ `consentRef` and `anchor` must be **present and null**, not absent: the two
328
+ carry different meanings, and a reader who cannot tell "declared empty" from
329
+ "never written" is guessing. The same rule governs `disclosure` and
330
+ `destination` under `source: "undeclared"` — the value keys stay, holding
331
+ `null`. Vector `013-disclosure-keys-omitted` locks that case.
332
+
333
+ `model` and `client` are required from v0.3 onward; `disclosure` and
334
+ `destination` from v0.4. An older receipt that lacks them is valid at its own
335
+ version — the version field decides which rows apply, which is why a v0.3
336
+ receipt in a v0.4 chain still verifies (`012-mixed-chain`).
337
+
338
+ `sig` is deliberately not in this table. A receipt without a signature is a
339
+ well-formed receipt that cannot be trusted — exit **13**, not 20.
340
+
341
+ ### Check order — measured
342
+
343
+ The order is part of the contract, because the exit code is a diagnosis and the
344
+ wrong order produces a true verdict with a false reason.
345
+
346
+ | Order | Check | Exit on failure |
347
+ |---|---|---|
348
+ | 1st | Schema | 20 |
349
+ | 2nd | Recomputed content hash | 10 |
350
+ | 3rd | `prevHash` link to the previous receipt | 11 |
351
+ | 4th | `seq` advances by exactly one | 12 |
352
+ | 5th | Ed25519 signature | 13 |
353
+ | 6th | Anchor, only under `--anchor-check` | 14 / 15 |
354
+
355
+ Receipts are processed in file order, and the first failure ends the run — so
356
+ the exit code names the first defective receipt, not the worst one.
357
+
358
+ Put the signature check first and a deleted receipt (`004`) or a sequence gap
359
+ (`005`) reports as a bad signature whenever the offending receipt is also
360
+ unsigned. The verdict "do not trust this chain" is unchanged; the operator is
361
+ sent to look at the wrong thing. The guard builds exactly that case — it
362
+ removes the signature from the one receipt that already breaks the chain — and
363
+ requires 11 and 12 rather than 13.
364
+
365
+ ### Canonical form, and what the vectors do not measure — prose
366
+
367
+ Content bytes are canonicalised with **JCS (RFC 8785)** and digested with
368
+ SHA-256, prefixed `sha256:`. `hash`, `sig` and `anchor` are removed first,
369
+ including the nested `chain.hash`.
370
+
371
+ `expected-hashes.json` publishes those digests, so a second implementation can
372
+ compare canonical bytes without holding our private key. Matching them is what
373
+ interoperability actually requires; signing is RFC 8032 and none of it is ours.
374
+
375
+ ⚠️ **Stated limit.** The published vectors are ASCII-keyed with integer and
376
+ string values. A naive sorted-key serialiser reproduces every one of their
377
+ hashes, so passing them does **not** demonstrate a conforming JCS
378
+ implementation. The number formatting rules (RFC 8785 §3.2.2.3) and the
379
+ UTF-16 code-unit sort order over non-ASCII keys are unexercised. A receipt
380
+ carrying a float, a large integer, or a non-ASCII key is where two
381
+ implementations will first disagree, and this repository does not currently
382
+ publish a vector that would catch it.
383
+
384
+ ### Which document is normative for what — prose
385
+
386
+ The IETF draft (`standards/`) defines Transformation Evidence and Coverage
387
+ Reconciliation, and states that signature and chain verification are **out of
388
+ scope** for it. That is deliberate: those belong to the receipt format, not to
389
+ the evidence structures layered on top.
390
+
391
+ So the draft is normative for the evidence structures; **this document is
392
+ normative for the receipt wire format** — signature payload, canonical form,
393
+ sequence rule, schema requirements and check order. An implementer who reads
394
+ only the draft has not been told how to verify a receipt, and should not
395
+ conclude the format leaves it open.
396
+
210
397
  ## Conformance vectors
211
398
 
212
399
  A specification that cannot be implemented from the document alone is a blog
213
- post. [`test-vectors/`](../test-vectors/) is the difference: twelve frozen cases,
400
+ post. [`test-vectors/`](../test-vectors/) is the difference: thirteen frozen cases,
214
401
  the public key, and a machine-readable manifest.
215
402
 
216
403
  ```
@@ -0,0 +1,58 @@
1
+ # Claims review — 0.2.38
2
+
3
+ - base: ef7b1dd
4
+ - head: 62e33e0
5
+ - surface: sha256:242f31fdcd8f29cc703230e9be7fdae412cfea48b5e23bd75ab513094cf1788a
6
+ - verdict: pass
7
+ - reviewer: maintainer, on a review by an outside model (Codex) that read the tree independently
8
+
9
+ ## Findings
10
+
11
+ ### 1. README.md:676 — "Ed25519-signed receipt per access"
12
+
13
+ - Claim: "tamper-evident hash-chained audit ledger · Ed25519-signed receipt per access
14
+ with an offline verifier"
15
+ - Mechanism: `Audit.log` writes a receipt only when a receipt sink is configured
16
+ (`src/audit.ts`); with no sink, nothing is written. `conarium-init` configures one,
17
+ so the default layout has receipts and a hand-written config need not.
18
+ - Why it falls short: the line states the receipt as a shipped property with no
19
+ condition attached, sixty lines below a paragraph in the same file that states the
20
+ condition correctly. A reader who skims the feature list and never reaches the top
21
+ gets the stronger claim.
22
+ - Disposition: reworded in `62e33e0` — "per access once a receipt sink is configured".
23
+
24
+ ### 2. docs/security/THREAT-MODEL.md:41 — "Every tool call ... is supposed to write a signed receipt"
25
+
26
+ - Claim: "Every tool call — allowed or denied — is supposed to write a signed receipt."
27
+ - Mechanism: same as above. The sentence sits in the trust-boundary section, directly
28
+ above the bypass list for that boundary.
29
+ - Why it falls short: this is the document where an unstated precondition costs the
30
+ most. A reader opens a threat model to learn what the system does *not* guarantee,
31
+ and the absence of a receipt sink was not among the bypasses listed.
32
+ - Disposition: reworded in `62e33e0`, and the implied bypass added to the list — a
33
+ gateway with no sink mediates access, leaves no evidence, and starts anyway.
34
+
35
+ ### 3. standards/draft-dogru-scitt-disclosure-evidence-05.md — new surface, first review
36
+
37
+ - Claim: the whole document, added since the last review and now a claim surface by
38
+ derivation (`currentDraft()` in `test/claim_surfaces.mjs`).
39
+ - Mechanism: its Implementation Status section was written from measurement against
40
+ the published 0.2.37 package, and the six behaviours it describes were re-measured
41
+ from that package before submission.
42
+ - Why it falls short: nothing in the suite compares that section against the code, so
43
+ it can go stale again between releases. The draft says so in its own text rather
44
+ than leaving a reader to discover it.
45
+ - Disposition: accepted — posted as `-05` on 2026-08-20; the published archive copy is
46
+ byte-identical to the file on `main`.
47
+
48
+ ### 4. README.md:28-30 — verification quickstart address
49
+
50
+ - Claim: the first instruction in the README, telling a reader to verify a live receipt
51
+ chain before trusting anything else on the page.
52
+ - Mechanism: the three files were served from `demo.conarium.dev`, which resolves to a
53
+ single machine that also runs unrelated services.
54
+ - Why it falls short: not a false claim, a fragile one. The one command a newcomer runs
55
+ first was the least resilient thing published.
56
+ - Disposition: moved to `conarium.dev/proof/*` (CDN) in `62e33e0`; bytes verified
57
+ identical (`sha256:32a1ea69…`) and the quickstart re-run from the new address on a
58
+ clean machine, exit 0.
@@ -0,0 +1,90 @@
1
+ # Claims review — 0.2.39
2
+
3
+ - base: d46b00d
4
+ - head: e182d9a
5
+ - surface: sha256:66ceac7f7ddc9957d3b4c1ec117f88b5a127b55c5c43ad121a3aa02f9e53bf5e
6
+ - verdict: pass
7
+ - reviewer: maintainer, re-reading the surfaces after the wire-format section and
8
+ the second locale pass were merged
9
+
10
+ The version was reviewed once already, before publication, on the translation
11
+ pass. That review recorded two limits for the next reader — that the locale
12
+ check tests for letters rather than language, and that Turkish markdown still
13
+ ships beside the code. Both were acted on before the version left the tree, so
14
+ this record supersedes the earlier one rather than repeating it.
15
+
16
+ The gate stopped the release, which is the first time it has stopped anything,
17
+ and the finding below is the one it produced.
18
+
19
+ ## Findings
20
+
21
+ ### 1. docs/RECEIPT-SPEC.md:220 — a section against overclaiming, overclaiming
22
+
23
+ - Claim: "Every statement in this section is asserted against the shipped
24
+ verifier by `test/spec_wire_contract.mjs`. If the code moves and a sentence
25
+ does not, that check fails — the sentences are measured, not remembered."
26
+ - Mechanism: `test/spec_wire_contract.mjs`, which makes fourteen assertions: the
27
+ signed payload against four candidate encodings, the payload byte length
28
+ against the number in the document, the order of the checks against receipts
29
+ built to fail two at once, the required-field table row by row, the vector
30
+ counts quoted in prose, that every manifest case is described, and that the
31
+ deep-link into this section resolves.
32
+ - Why it falls short: the section contains statements none of those touch —
33
+ that `sig.alg` other than `Ed25519` is rejected before the key is loaded, that
34
+ an unknown `keyId` is a failure rather than a skip, that a non-canonical
35
+ base64 signature is refused rather than normalised, what `--expect-seq-from`
36
+ pins, the JCS limits paragraph, and the whole section on which document is
37
+ normative for what. "Every statement" asserted a property over a section when
38
+ it held over part of it, which is the same shape as a conformance runner
39
+ reporting a class it sampled — the failure this repository has been arguing
40
+ about on the SCITT list for three days, in its own document.
41
+ - Disposition: reworded in e182d9a. The four measured parts are labelled
42
+ **measured** in their headings; the two that are not are labelled **prose**;
43
+ and the introduction states that the prose is not compared to the code by
44
+ anything in the test suite.
45
+
46
+ ### 2. docs/RECEIPT-SPEC.md — `seq`, where the label needed splitting
47
+
48
+ - Claim: `### seq advances by exactly one — measured` (the first correction's
49
+ own first attempt).
50
+ - Mechanism: the order test runs `005-seq-gap` and requires exit 12 with the
51
+ signature removed from the receipt that fails.
52
+ - Why it falls short: that measures the gap case and its position in the check
53
+ order. The non-increasing case and `--expect-seq-from` are exercised by no
54
+ vector, so labelling the whole section "measured" would have repeated the
55
+ first finding one heading down.
56
+ - Disposition: reworded in e182d9a. The section now states which half is
57
+ measured and names the two behaviours no vector exercises.
58
+
59
+ ### 3. README.md:347 — a count that had been wrong in two files
60
+
61
+ - Claim: "conformance vectors — twelve frozen cases plus a machine-readable
62
+ manifest".
63
+ - Mechanism: `test-vectors/manifest.json`, which carries thirteen cases.
64
+ - Why it falls short: the same claim appeared in `README.md` and
65
+ `docs/RECEIPT-SPEC.md`, and the test suite stayed green because each file was
66
+ internally consistent. A reader counting the table in `test-vectors/README.md`
67
+ would have found thirteen and had no way to tell which number was the stale
68
+ one.
69
+ - Disposition: corrected, and the recurrence closed — prose counts in all three
70
+ files are now compared against the manifest by `test/spec_wire_contract.mjs`,
71
+ and every manifest case must appear in the vector README's table.
72
+
73
+ ## Limits recorded rather than left to be found
74
+
75
+ - The prose half of the wire-format section is accurate on this revision and
76
+ pinned by nothing. It is marked as such in the document; a reader who wants a
77
+ guarantee has the four measured parts and the vectors.
78
+ - `test/spec_wire_contract.mjs` compares any prose "N cases" in three files
79
+ against the manifest. A future sentence in one of those files about some other
80
+ document's vector count will fail this check wrongly. The message names the
81
+ file and the phrase, so the cost is one edit, but it is a known edge rather
82
+ than a discovered one.
83
+ - The locale check now reads words as well as letters, and the word list is
84
+ deliberately small: it excludes every Turkish word that is also English. A
85
+ Turkish sentence built only from words outside that list still passes.
86
+ - Turkish design history under `docs/` still ships in the package — 308 word
87
+ occurrences across 19 packed files at the time of this review. The check
88
+ prints that number on every green run rather than passing over it. Whether
89
+ that history belongs in a tarball is a packaging decision, not a claim defect,
90
+ and it is not made here.
@@ -38,9 +38,14 @@ Whoever controls the config controls the policy. The code cannot save you from y
38
38
  **Today:** MCP stdio or Streamable HTTP. SQL is parsed (`pgsql-ast-parser`), not grepped.
39
39
  Writes are refused by the connector. Tables not on `allowTables` are denied.
40
40
  `maskColumns` plus content scanners run before the model sees a row.
41
- Every tool call — allowed or denied — is supposed to write a signed receipt.
41
+ Every tool call — allowed or denied — is supposed to write a signed receipt once a
42
+ receipt sink is configured. Without one, nothing is written and there is nothing to
43
+ verify later.
42
44
 
43
45
  **Bypass surface:**
46
+ - A gateway with no receipt sink mediates access and leaves no evidence of it.
47
+ `conarium-init` configures a sink, so the default layout has one, but a
48
+ hand-written config need not — and the gateway starts either way.
44
49
  - A bare name in running prose is not detected. "Ahmet called" goes through.
45
50
  - Street addresses are not detected.
46
51
  - Passport numbers in free text (non-MRZ) are not detected.
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@conarium-ai/core",
3
- "version": "0.2.37",
3
+ "version": "0.2.39",
4
4
  "mcpName": "io.github.dogrucanemek-alt/conarium",
5
- "//files-artefakt": "examples/ altindaki uretilmis dosyalar (ozel anahtar, makbuz/denetim JSONL) ELENIR. .gitignore npm'i baglamaz: izin listesinde 'examples' oldugu icin demoyu kosturmus bir makinede 'npm publish' _keys/audit-ed25519.pem'i (OZEL ANAHTAR) ve makbuzlari yayinliyordu. test/pack_artefakt.mjs bunu kilitler. Elemeler examples/ ile SINIRLI: test-vectors/ altindaki receipts.jsonl ve .pub.pem YAYINLANMAK ZORUNDA, yoksa ucuncu taraf konformans vektorlerini kosturamaz.",
6
- "//files": "Pakete NE gireceginin izin listesi. Liste olmadan npm her seyi gonderiyordu: 296 dosya / 1.5 MB — CI workflowlari, gitleaks ayari, 137 KB pazarlama gorseli, sitenin api/chat.js dosyasi. Bir bankanin guvenlik ekibi tarball'i acip bunlari gorur. scripts/ BILEREK var: conarium-reconcile calisirken scripts/pg-snapshot.sql'e atif yapiyor, olmazsa kullanici destek maili yazar.",
5
+ "//files-artefakt": "Generated files under examples/ (private key, receipt/audit JSONL) are EXCLUDED. .gitignore does not bind npm: because the allow-list contained 'examples', `npm publish` on a machine that had run the demo was shipping _keys/audit-ed25519.pem (PRIVATE KEY) and the receipts. test/pack_artefakt.mjs locks this. The exclusions are LIMITED to examples/: receipts.jsonl and .pub.pem under test-vectors/ MUST ship, or a third party cannot run the conformance vectors.",
6
+ "//files": "Allow-list of what enters the package. Without it npm sent everything: 296 files / 1.5 MB — CI workflows, gitleaks config, a 137 KB marketing image, the site's api/chat.js. A bank security team opens the tarball and sees those. scripts/ is here ON PURPOSE: conarium-reconcile references scripts/pg-snapshot.sql at runtime; without it the user files a support mail.",
7
7
  "files": [
8
8
  "dist",
9
9
  "bin",
10
10
  "scripts",
11
11
  "docs",
12
12
  "!docs/reviews",
13
+ "!docs/teaching",
14
+ "!docs/teaching/**",
13
15
  "!docs/benchmarks/*.cpuprofile",
14
16
  "public",
15
17
  "assets",
@@ -105,7 +107,7 @@
105
107
  "node-sql-parser": "^5.4.0",
106
108
  "pgsql-ast-parser": "^12.0.2",
107
109
  "postgres": "^3.4.4",
108
- "zod": "^3.23.8"
110
+ "zod": "4.4.3"
109
111
  },
110
112
  "devDependencies": {
111
113
  "@jazzer.js/core": "^4.0.0",
package/public/app.js CHANGED
@@ -22,7 +22,7 @@ document.addEventListener('DOMContentLoaded', () => {
22
22
  const empty = document.getElementById('receipt-empty')
23
23
  if (empty && name === 'receipts') {
24
24
  empty.hidden = false
25
- empty.textContent = 'Makbuzlar alanı bulunamadı.'
25
+ empty.textContent = 'Receipts panel not found.'
26
26
  }
27
27
  }
28
28
  }
@@ -223,7 +223,7 @@ document.addEventListener('DOMContentLoaded', () => {
223
223
  try {
224
224
  const res = await apiFetch('/api/receipts')
225
225
  if (!res.ok) {
226
- ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı (' + res.status + ').')
226
+ ConariumReceiptsPanel.showError(ui, 'Could not load the receipt list (' + res.status + ').')
227
227
  return
228
228
  }
229
229
  const data = await res.json()
@@ -237,7 +237,7 @@ document.addEventListener('DOMContentLoaded', () => {
237
237
  },
238
238
  })
239
239
  } catch (e) {
240
- ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı.')
240
+ ConariumReceiptsPanel.showError(ui, 'Could not load the receipt list.')
241
241
  }
242
242
  }
243
243
 
@@ -249,18 +249,18 @@ document.addEventListener('DOMContentLoaded', () => {
249
249
  const res = await apiFetch('/api/receipts/' + encodeURIComponent(id))
250
250
  if (!res.ok) {
251
251
  detail.hidden = false
252
- detail.textContent = 'Makbuz okunamadı (' + res.status + ').'
252
+ detail.textContent = 'Could not read the receipt (' + res.status + ').'
253
253
  return
254
254
  }
255
255
  const data = await res.json()
256
256
  detail.hidden = false
257
257
  detail.innerHTML = data.html || ''
258
258
  if (data.html && /BEGIN PRIVATE KEY|BEGIN.*PRIVATE/.test(data.html)) {
259
- detail.textContent = 'özel anahtar panele düştü — gösterilmedi'
259
+ detail.textContent = 'a private key reached the panel — not shown'
260
260
  }
261
261
  } catch (e) {
262
262
  detail.hidden = false
263
- detail.textContent = 'Makbuz okunamadı.'
263
+ detail.textContent = 'Could not read the receipt.'
264
264
  }
265
265
  }
266
266