@conarium-ai/core 0.2.19 → 0.2.21

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 (129) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LIMITATIONS.md +8 -0
  3. package/LIMITATIONS.tr.md +7 -0
  4. package/README.md +20 -3
  5. package/bin/conarium-doctor.mjs +53 -5
  6. package/conformance/KNOWN-GAPS.md +20 -0
  7. package/conformance/README.md +85 -0
  8. package/conformance/adapters/README.md +59 -0
  9. package/conformance/adapters/conarium.mjs +17 -0
  10. package/conformance/cases/coverage/expect-count-pin.json +13 -0
  11. package/conformance/cases/coverage/tail-without-pin.json +15 -0
  12. package/conformance/cases/evidence/001-single-receipt.json +16 -0
  13. package/conformance/cases/evidence/002-chain-of-three.json +16 -0
  14. package/conformance/cases/evidence/003-tampered-field.json +16 -0
  15. package/conformance/cases/evidence/004-prevhash-break.json +16 -0
  16. package/conformance/cases/evidence/005-seq-gap.json +16 -0
  17. package/conformance/cases/evidence/006-bad-signature.json +16 -0
  18. package/conformance/cases/evidence/007-schema-invalid.json +16 -0
  19. package/conformance/cases/evidence/008-unsigned-no-pubkey.json +13 -0
  20. package/conformance/cases/evidence/009-unsigned-but-pubkey-given.json +16 -0
  21. package/conformance/cases/gate/deny-alias.json +13 -0
  22. package/conformance/cases/gate/deny-case-fold.json +13 -0
  23. package/conformance/cases/gate/deny-comment-between.json +13 -0
  24. package/conformance/cases/gate/deny-cte.json +13 -0
  25. package/conformance/cases/gate/deny-join.json +13 -0
  26. package/conformance/cases/gate/deny-plain.json +13 -0
  27. package/conformance/cases/gate/deny-quoted-lower.json +13 -0
  28. package/conformance/cases/gate/deny-schema-qualify.json +13 -0
  29. package/conformance/cases/gate/deny-string-agg.json +13 -0
  30. package/conformance/cases/gate/deny-subquery.json +13 -0
  31. package/conformance/cases/gate/deny-unqualified.json +13 -0
  32. package/conformance/cases/gate/deny-updlock.json +13 -0
  33. package/conformance/cases/gate/deny-user-fn.json +13 -0
  34. package/conformance/cases/gate/fail-empty.json +13 -0
  35. package/conformance/cases/gate/fail-garbage.json +13 -0
  36. package/conformance/cases/gate/fail-two-statements.json +13 -0
  37. package/conformance/cases/gate/write-copy.json +13 -0
  38. package/conformance/cases/gate/write-create.json +13 -0
  39. package/conformance/cases/gate/write-delete.json +13 -0
  40. package/conformance/cases/gate/write-drop.json +13 -0
  41. package/conformance/cases/gate/write-insert.json +13 -0
  42. package/conformance/cases/gate/write-merge.json +13 -0
  43. package/conformance/cases/gate/write-truncate.json +13 -0
  44. package/conformance/cases/gate/write-update.json +13 -0
  45. package/conformance/cases/inference/cohort-narrowing.json +13 -0
  46. package/conformance/cases/inference/count-channel.json +13 -0
  47. package/conformance/cases/inference/exists-channel.json +13 -0
  48. package/conformance/cases/inference/repeated-probe.json +13 -0
  49. package/conformance/cases/masking/mask-alias.json +14 -0
  50. package/conformance/cases/masking/mask-case.json +14 -0
  51. package/conformance/cases/masking/mask-concat.json +14 -0
  52. package/conformance/cases/masking/mask-subquery.json +14 -0
  53. package/conformance/cases/rowcap/cap-nested.json +14 -0
  54. package/conformance/cases/rowcap/cap-raise-limit.json +14 -0
  55. package/conformance/cases/rowcap/cap-union.json +14 -0
  56. package/conformance/claims/conarium.json +12 -0
  57. package/conformance/lib/status.mjs +48 -0
  58. package/conformance/policies/mask-email.json +5 -0
  59. package/conformance/policies/protected-email.json +6 -0
  60. package/conformance/policies/sql-gate.json +6 -0
  61. package/conformance/profiles.md +15 -0
  62. package/conformance/run.mjs +208 -0
  63. package/conformance/schema/case.json +42 -0
  64. package/dist/anchor.d.ts.map +1 -1
  65. package/dist/anchor.js.map +1 -1
  66. package/dist/audit.d.ts.map +1 -1
  67. package/dist/audit.js +4 -1
  68. package/dist/audit.js.map +1 -1
  69. package/dist/config.d.ts +60 -40
  70. package/dist/config.d.ts.map +1 -1
  71. package/dist/config.js +13 -2
  72. package/dist/config.js.map +1 -1
  73. package/dist/connectors/custom-sql.d.ts.map +1 -1
  74. package/dist/connectors/docs.d.ts.map +1 -1
  75. package/dist/connectors/jira.d.ts.map +1 -1
  76. package/dist/connectors/openapi.d.ts.map +1 -1
  77. package/dist/connectors/openapi.js.map +1 -1
  78. package/dist/connectors/postgres.d.ts.map +1 -1
  79. package/dist/connectors/slack.d.ts.map +1 -1
  80. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  81. package/dist/connectors/zion.d.ts.map +1 -1
  82. package/dist/console-handoff.js.map +1 -1
  83. package/dist/console-notify.js.map +1 -1
  84. package/dist/console-ready.js.map +1 -1
  85. package/dist/console-shortcut.js.map +1 -1
  86. package/dist/console.d.ts +6 -6
  87. package/dist/console.js.map +1 -1
  88. package/dist/coverage.d.ts +1 -1
  89. package/dist/coverage.js.map +1 -1
  90. package/dist/custom_patterns.d.ts.map +1 -1
  91. package/dist/governance.d.ts +7 -0
  92. package/dist/governance.d.ts.map +1 -1
  93. package/dist/governance.js +22 -3
  94. package/dist/governance.js.map +1 -1
  95. package/dist/http.d.ts.map +1 -1
  96. package/dist/http.js.map +1 -1
  97. package/dist/iban.d.ts +1 -1
  98. package/dist/iban.js.map +1 -1
  99. package/dist/keys.js.map +1 -1
  100. package/dist/license.js.map +1 -1
  101. package/dist/llm-gate.js.map +1 -1
  102. package/dist/mask-text.js.map +1 -1
  103. package/dist/ots/client.js.map +1 -1
  104. package/dist/ots/codec.d.ts.map +1 -1
  105. package/dist/ots/codec.js.map +1 -1
  106. package/dist/protected-columns.d.ts +19 -0
  107. package/dist/protected-columns.d.ts.map +1 -0
  108. package/dist/protected-columns.js +410 -0
  109. package/dist/protected-columns.js.map +1 -0
  110. package/dist/rate_limit.d.ts.map +1 -1
  111. package/dist/receipt-view.d.ts.map +1 -1
  112. package/dist/receipt-view.js.map +1 -1
  113. package/dist/receipt.d.ts +1 -1
  114. package/dist/scripts/discover_schema.js.map +1 -1
  115. package/dist/search_policy.js.map +1 -1
  116. package/dist/sql-gate/dispatch.d.ts +1 -1
  117. package/dist/sql-gate/dispatch.d.ts.map +1 -1
  118. package/dist/sql-gate/mssql.js.map +1 -1
  119. package/dist/sql-gate/oracle.js.map +1 -1
  120. package/dist/sql-gate/rules.d.ts +1 -1
  121. package/dist/sql-gate/rules.d.ts.map +1 -1
  122. package/dist/tokens.js.map +1 -1
  123. package/dist/types.d.ts +19 -1
  124. package/dist/types.d.ts.map +1 -1
  125. package/dist/update-check.js.map +1 -1
  126. package/docs/CONTRIBUTING.md +7 -0
  127. package/docs/RECEIPT-SPEC.md +6 -1
  128. package/package.json +5 -4
  129. package/scripts/gacs-query-adapter.mjs +52 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.21 — 2026-08-16
4
+
5
+ Findings from an independent review that cloned the repository, installed it and ran
6
+ the tests, the hardening checks and the conformance suite on its own machine. None of
7
+ the four is a vulnerability: one is a claim this project stated less carefully than it
8
+ states everything else, and three are places where a misconfiguration could stay quiet.
9
+
10
+ - **The IETF draft is described as what it is.** The README said only that
11
+ `draft-dogru-scitt-disclosure-evidence` is "on the IETF Datatracker." A reader's
12
+ legal or security team can take that for a standards process; the Datatracker page
13
+ itself says the opposite. It now reads: individual submission, not adopted by a
14
+ working group, no formal standing — an Internet-Draft is a dated public record, not
15
+ a standard. Published so the receipt format can be implemented without us.
16
+
17
+ - **The production profile announces what it changes.** Selecting
18
+ `profile: production` quietly turned on the OpenTimestamps anchor sink when none was
19
+ set, which means an outbound HTTPS connection, and quietly set
20
+ `CONARIUM_AUDIT_REQUIRE_SIG=1`. Both are documented and `conarium-doctor` reports
21
+ them, but an operator who does not run the doctor never saw it happen. Each implicit
22
+ change now prints one line to stderr — never stdout, which would corrupt the MCP
23
+ stream — and nothing is printed when the operator set the value themselves. This
24
+ README says elsewhere that a governance product making an undisclosed outbound
25
+ connection has already lost the argument; that sentence should apply to itself.
26
+
27
+ - **`doctor` warns when a masked column is not a protected one.** A column in
28
+ `maskColumns` but not in `protectedColumns` leaves exactly the inference channel
29
+ LIMITATIONS describes: the value is hidden, and a predicate on it still answers
30
+ questions about it. That can be a deliberate choice, so this is a warning and not a
31
+ refusal — it exists to make sure it is a choice.
32
+
33
+ - **`doctor` tests a custom pattern instead of only compiling it.** A rule may now
34
+ carry an optional `sample`. A pattern that compiles but does not match its own
35
+ sample is a warning; a pattern with no sample is reported as untested rather than
36
+ passing silently. Neither the pattern nor the sample is ever printed. Compiling is
37
+ not catching, and a typo in a customer-specific rule used to protect nothing while
38
+ looking healthy.
39
+
40
+ - Contributing docs now carry the rule the four findings share: a setting that weakens
41
+ a protection has to be noisy — in the receipt, in the doctor, and at startup.
42
+
43
+ ## 0.2.20 — 2026-08-16
44
+
45
+ - **`policy.protectedColumns`: a column you may read but not ask about.**
46
+ `maskColumns` hides a value in the result. LIMITATIONS has always said what
47
+ that leaves open: `WHERE email LIKE 'a%'` still reaches the database, and one
48
+ row versus none answers a question about the value it never printed. The
49
+ answer until now was to refuse the whole table. A column listed in
50
+ `protectedColumns` is the narrower answer — same glob syntax, still masked on
51
+ the way out, but the query is refused before it reaches the database if the
52
+ column appears in `WHERE`, `HAVING`, `JOIN … ON`, `ORDER BY`, `GROUP BY`,
53
+ `SELECT DISTINCT`, or a derived `SELECT` expression. Aliases, CTEs, table
54
+ aliases, function wrappers, subqueries and both arms of a `UNION` are walked;
55
+ a shape the walk cannot classify is refused rather than passed. A profile
56
+ cannot add or relax the field, and a dialect whose AST this walk cannot
57
+ traverse refuses to boot instead of quietly enforcing nothing.
58
+
59
+ This is not a claim that masked values in general became unlearnable. It
60
+ applies to listed columns, and counting channels (`COUNT`, `EXISTS`, repeated
61
+ probing) remain — LIMITATIONS says so in both languages.
62
+
63
+ - **Behaviour is byte-identical without the field.** A config that does not set
64
+ `protectedColumns` runs exactly as 0.2.19 did; a test locks that.
65
+
3
66
  ## 0.2.19 — 2026-08-16
4
67
 
5
68
  - **Listable in the official MCP Registry.** `package.json` carries `mcpName`
package/LIMITATIONS.md CHANGED
@@ -54,6 +54,14 @@ masked value without ever displaying it. An assistant with a valid token can
54
54
  learn masked values bit by bit this way. If a column must be unlearnable rather
55
55
  than merely hidden, do not allow the table that carries it.
56
56
 
57
+ A column listed in `policy.protectedColumns` is the narrower exception: the
58
+ same glob syntax as `maskColumns`, and the value is still masked in the result.
59
+ In addition, the column may not appear in `WHERE`, `HAVING`, `JOIN … ON`,
60
+ `ORDER BY`, `GROUP BY`, or a derived `SELECT` expression. The query is refused
61
+ before it reaches the database. Columns that are not on that list are unchanged
62
+ — the paragraph above still applies to them in full. This is not a claim that
63
+ masked values in general have become unlearnable.
64
+
57
65
  ## The row cap is per query, not per session
58
66
 
59
67
  `maxRows` caps a single query. `OFFSET` is preserved, so an allowed, unmasked
package/LIMITATIONS.tr.md CHANGED
@@ -53,6 +53,13 @@ onun hakkındaki bir soruyu cevaplar. Geçerli jetonu olan bir asistan maskeli
53
53
  değerleri bu yolla parça parça öğrenebilir. Bir sütunun yalnızca gizli değil
54
54
  **öğrenilemez** olması gerekiyorsa, onu taşıyan tabloya izin verme.
55
55
 
56
+ `policy.protectedColumns` listesindeki bir sütun daha dar bir istisnadır:
57
+ sözdizimi `maskColumns` ile aynıdır ve değer sonuçta yine maskelenir. Ayrıca
58
+ sütun `WHERE`, `HAVING`, `JOIN … ON`, `ORDER BY`, `GROUP BY` veya türetilmiş
59
+ bir `SELECT` ifadesinde geçemez — sorgu veritabanına gitmeden reddedilir.
60
+ Listede olmayan sütunlar için yukarıdaki paragraf aynen geçerlidir. Bu,
61
+ maskelenen değerlerin genel olarak öğrenilemez olduğu iddiası değildir.
62
+
56
63
  ## Satır tavanı sorgu başınadır, oturum başına değil
57
64
 
58
65
  `maxRows` tek sorguyu sınırlar. `OFFSET` korunur; izinli ve maskesiz bir tablo
package/README.md CHANGED
@@ -27,7 +27,10 @@ only copy; this repo does not keep a second one.
27
27
  ## Standards
28
28
 
29
29
  [draft-dogru-scitt-disclosure-evidence](https://datatracker.ietf.org/doc/draft-dogru-scitt-disclosure-evidence/)
30
- on the IETF Datatracker. Source files live in [`standards/`](standards/).
30
+ is an individual submission. Not adopted by an IETF working group, and it
31
+ carries no formal standing — an Internet-Draft is a dated public record, not a standard.
32
+ It is published so the receipt format can be implemented without us.
33
+ Source files live in [`standards/`](standards/).
31
34
 
32
35
  ## 👁️ The Problem
33
36
 
@@ -124,6 +127,8 @@ Deliberately narrow, because this is the one feature that can *loosen* protectio
124
127
  - A profile may override **`maskColumns`, `maxRows` and `maskLabelledNames` — and
125
128
  nothing else.** Table, tool and connector permissions stay global; a profile can
126
129
  never widen what is reachable, only what is legible within it.
130
+ `protectedColumns` is not overlayable: a profile that could drop it would be a
131
+ per-person back door.
127
132
  - **Per-user tokens only.** An actor authenticated with a shared token never
128
133
  receives a profile. "Whoever holds this string sees unmasked PII" is precisely
129
134
  the failure this product exists to prevent.
@@ -511,12 +516,22 @@ Control access using a simple `conarium.json` policy file:
511
516
  "allowTables": ["public.customers", "public.orders"],
512
517
  "denyTables": ["public.secrets", "public.financials"],
513
518
  "maskColumns": ["email", "ssn", "*.card", "*.api_key"],
519
+ "protectedColumns": ["*.email", "customers.tckn"],
514
520
  "allowConnectors": ["postgres-main", "docs"]
515
521
  }
516
522
  ```
517
523
 
518
524
  Anything not in `allowTables` is denied by default; matched `maskColumns` are redacted to `[MASKED_PII]` before the data ever reaches the model.
519
525
 
526
+ `protectedColumns` uses the same glob syntax. Every pattern is also masked in
527
+ the result. In addition, that column may not appear in a predicate (`WHERE`,
528
+ `HAVING`, `JOIN … ON`, `ORDER BY`, `GROUP BY`) or a derived `SELECT` expression
529
+ — the query is refused. A bare `SELECT email` is still allowed and comes back
530
+ masked. Omit the field and behaviour is unchanged. A profile cannot set it.
531
+ `mssql` / `oracle` refuse to boot if the field is non-empty: those gates cannot
532
+ walk predicate positions, and this product does not claim a rule it cannot
533
+ enforce.
534
+
520
535
  `policy.dialect` selects the SQL gate the `query` tool uses: `postgres` (omitted default), `mssql`, or `oracle`. It is the operator's declaration — Conarium does not guess the dialect from the statement. A typo or `mysql` rejects the config.
521
536
 
522
537
  > **Connectors are fail-closed.** `allowConnectors` is a strict allow-list:
@@ -552,8 +567,10 @@ scanner. This is not a second masking path and it does not replace
552
567
  `maskColumns`.
553
568
 
554
569
  Each rule needs a name (what the receipt records), a pattern, optional
555
- column globs, and a mask label. A broken or ReDoS-shaped pattern rejects
556
- the config; the pattern text is never written to logs or receipts.
570
+ column globs, and a mask label. An optional `sample` is what `conarium-doctor`
571
+ tries the compiled pattern against — compile success is not a catch. A
572
+ broken or ReDoS-shaped pattern rejects the config; the pattern and the
573
+ sample are never written to logs, receipts, or doctor output.
557
574
 
558
575
  ```json
559
576
  {
@@ -272,17 +272,32 @@ if (config) {
272
272
  // 4. Is anything actually being protected?
273
273
  const pol = config.policy || {}
274
274
  const hasMask = Array.isArray(pol.maskColumns) && pol.maskColumns.length > 0
275
+ const hasProtected = Array.isArray(pol.protectedColumns) && pol.protectedColumns.length > 0
275
276
  const hasDeny = Array.isArray(pol.denyTables) && pol.denyTables.length > 0
276
277
  const hasAllowTables = Array.isArray(pol.allowTables) && pol.allowTables.length > 0
277
- if (!hasMask && !hasDeny && !hasAllowTables) {
278
+ if (!hasMask && !hasProtected && !hasDeny && !hasAllowTables) {
278
279
  warn(
279
280
  'Policy surface',
280
- 'no maskColumns, no denyTables, no allowTables',
281
+ 'no maskColumns, no protectedColumns, no denyTables, no allowTables',
281
282
  'Content detectors (email / national id / card / secrets) still run, but no column or table rule is set. ' +
282
283
  'That is a valid choice — make sure it is a choice.',
283
284
  )
284
285
  } else {
285
- ok('Policy surface', [hasAllowTables && 'allowTables', hasDeny && 'denyTables', hasMask && 'maskColumns'].filter(Boolean).join(' + '))
286
+ ok('Policy surface', [hasAllowTables && 'allowTables', hasDeny && 'denyTables', hasMask && 'maskColumns', hasProtected && 'protectedColumns'].filter(Boolean).join(' + '))
287
+ }
288
+ if (hasProtected) {
289
+ ok('policy.protectedColumns', pol.protectedColumns.join(', '))
290
+ }
291
+ if (hasMask) {
292
+ const protectedSet = new Set(hasProtected ? pol.protectedColumns : [])
293
+ for (const col of pol.maskColumns) {
294
+ if (protectedSet.has(col)) continue
295
+ warn(
296
+ 'policy.maskColumns',
297
+ `${col} is in maskColumns but not in protectedColumns. Masking hides the value; LIMITATIONS.md ("Masking hides values; it does not make them unlearnable") still applies. That is a valid choice — make sure it is a choice.`,
298
+ 'Add the column to protectedColumns if predicates on it must be refused. Leave it only in maskColumns if hiding the value is enough.',
299
+ )
300
+ }
286
301
  }
287
302
 
288
303
  // 4b. Raised maxRows — performance warning, not a deny.
@@ -390,8 +405,41 @@ if (config) {
390
405
  } else {
391
406
  try {
392
407
  const { compileCustomPatterns } = await import(pathToFileURL(compilerPath).href)
393
- compileCustomPatterns(patterns)
394
- ok('policy.customPatterns', `${patterns.length} compiled: ${patternNames.join(', ')}`)
408
+ const compiled = compileCustomPatterns(patterns)
409
+ const byName = new Map(compiled.map((c) => [c.name, c]))
410
+ for (const p of patterns) {
411
+ const name = p && typeof p.name === 'string' ? p.name : 'unnamed'
412
+ const sample = p && typeof p.sample === 'string' ? p.sample : ''
413
+ const rule = byName.get(name)
414
+ if (!sample) {
415
+ unseen(
416
+ 'policy.customPatterns',
417
+ `pattern ${name} compiled but was not tested (no sample)`,
418
+ 'Add a sample that the pattern should match. The doctor will not print the sample.',
419
+ )
420
+ continue
421
+ }
422
+ if (!rule?.re) {
423
+ unseen(
424
+ 'policy.customPatterns',
425
+ `pattern ${name} compiled but was not tested (no compiled rule)`,
426
+ 'Rebuild the package and rerun the doctor.',
427
+ )
428
+ continue
429
+ }
430
+ rule.re.lastIndex = 0
431
+ const hit = rule.re.test(sample)
432
+ rule.re.lastIndex = 0
433
+ if (hit) {
434
+ ok('policy.customPatterns', `pattern ${name} compiled and matched its sample`)
435
+ } else {
436
+ warn(
437
+ 'policy.customPatterns',
438
+ `pattern ${name} compiled but did not match its own sample`,
439
+ 'The pattern compiled. It did not match the sample you gave it. Fix the pattern or the sample. Neither is printed.',
440
+ )
441
+ }
442
+ }
395
443
  } catch (e) {
396
444
  fail(
397
445
  'policy.customPatterns',
@@ -0,0 +1,20 @@
1
+ # Known gaps
2
+
3
+ These cases are in the suite on purpose. They are not hidden, and they
4
+ are not claimed as capabilities.
5
+
6
+ `inference-control` is **not** in the claims file. The term is bounded
7
+ inference controls: a control can raise the cost of an attack. It does
8
+ not make a value unlearnable.
9
+
10
+ | id | Expected status | Why it is listed |
11
+ |---|---|---|
12
+ | `inference/count-channel` | NOT_COVERED | `SELECT count(*) … WHERE email LIKE 'a%'` under mask-only policy. 1 vs 0 answers a question about a masked value. |
13
+ | `inference/exists-channel` | NOT_COVERED | `id IN (SELECT id … WHERE email LIKE …)` is the 1/0 channel. SQL `EXISTS` is already refused as an unknown function. |
14
+ | `inference/repeated-probe` | NOT_COVERED | Successive narrowing predicates are not budgeted per session. |
15
+ | `inference/cohort-narrowing` | NOT_COVERED | `GROUP BY` on an allowed column yields cohort sizes. |
16
+ | `coverage/tail-without-pin` | DETECTED_WITH_EXTERNAL_PIN | A hash chain cannot see receipts deleted from the end unless a pin or anchor is supplied. |
17
+
18
+ Each of these files sets `expectedFail: true`. The runner treats the
19
+ listed status as the expected outcome. If a listed gap starts returning
20
+ `ENFORCED`, the job fails — the list must be edited in the same change.
@@ -0,0 +1,85 @@
1
+ # GACS — Governed Access Conformance Suite
2
+
3
+ An open, hostile test suite for governed data access. Anyone can run it
4
+ against their own product by writing an adapter. This repository ships a
5
+ reference adapter; the suite does not import that product.
6
+
7
+ A one-person team maintains both the suite and one implementation. That
8
+ is stated here so nobody has to discover it later.
9
+
10
+ Dokümandan implement edilemiyorsa spesifikasyon değil blog yazısıdır.
11
+
12
+ If a frozen case stops matching, do not edit the expectation so the
13
+ suite goes green. Either the implementation changes, or the
14
+ specification / version changes and that change is recorded in the
15
+ open. There is no script that bulk-rewrites expected results.
16
+
17
+ ## What it tests
18
+
19
+ | Class | Profile | Typical claim |
20
+ |---|---|---|
21
+ | `evidence/` | GACS-D1 | Receipt chain, signature, tamper, mid-chain delete, seq gap |
22
+ | `gate/` `rowcap/` `masking/` | GACS-E1 | Table policy, row cap, column masking |
23
+ | `coverage/` | GACS-C1 | Length pins; tail drop without a pin |
24
+ | `inference/` | GACS-I1 | Count / existence / probe / cohort channels |
25
+
26
+ See [profiles.md](profiles.md). A procurement line can cite a profile
27
+ instead of inventing a score.
28
+
29
+ ## What it does not test
30
+
31
+ - Timing side channels
32
+ - A session-wide probe budget
33
+ - Whether a live database role could bypass the gate
34
+ - That a receipt was *correct* when it was written
35
+ - That this suite's authors are a large vendor
36
+
37
+ Every case has a `doesNotTest` field. Empty is rejected.
38
+
39
+ ## Two regimes
40
+
41
+ **conformance** — frozen vectors. `PASS` / `FAIL` means "matched the
42
+ recorded expectation."
43
+
44
+ **resistance** — hostile probes. The runner will not print `PASS`.
45
+ Statuses: `ENFORCED`, `BOUNDED(<limit>)`, `NOT_COVERED`,
46
+ `DECLARED_ONLY`, `DETECTED_WITH_EXTERNAL_PIN`, `NOT_CLAIMED`.
47
+
48
+ An unclaimed capability is `NOT_CLAIMED` and is not a failure. A listed
49
+ gap (`expectedFail`) that starts returning `ENFORCED` *is* a failure —
50
+ [KNOWN-GAPS.md](KNOWN-GAPS.md) must be edited in the same change.
51
+
52
+ No percentage, letter grade, or ranking is produced.
53
+
54
+ ## How to write an adapter
55
+
56
+ See [adapters/README.md](adapters/README.md). Thirty lines is enough.
57
+
58
+ ```
59
+ node conformance/run.mjs --adapter <your-adapter> --claims <your-claims.json>
60
+ ```
61
+
62
+ Claims file: implementation name, version, the claims you actually
63
+ make, and optionally a `verify` command for receipt files.
64
+
65
+ ## How to run the reference adapter
66
+
67
+ ```
68
+ npm run build
69
+ node conformance/run.mjs --adapter conformance/adapters/conarium.mjs --claims conformance/claims/conarium.json
70
+ ```
71
+
72
+ Exit 0 means every *claimed* case held and every listed gap is still a
73
+ gap. Exit 1 means a claimed miss or a gap that closed without the list
74
+ being updated.
75
+
76
+ ## Falsify it
77
+
78
+ If you think a case is wrong, open an issue. The value of the suite is
79
+ that it can be shown to be wrong.
80
+
81
+ ## Relation to the SCITT draft
82
+
83
+ This suite also exercises mechanisms described in
84
+ [draft-dogru-scitt-disclosure-evidence](https://datatracker.ietf.org/doc/draft-dogru-scitt-disclosure-evidence/).
85
+ GACS stands on its own if that draft moves or dies.
@@ -0,0 +1,59 @@
1
+ # Query adapter
2
+
3
+ The runner never imports an implementation. It starts your adapter as a
4
+ child process:
5
+
6
+ ```
7
+ <adapter> --policy <policy.json> --query <query.sql>
8
+ ```
9
+
10
+ Write one JSON object to stdout, then exit 0. The decision lives in the
11
+ JSON. A non-zero exit is a tool failure, not a `deny`.
12
+
13
+ ```json
14
+ {
15
+ "decision": "allow",
16
+ "rewrittenSql": "SELECT id FROM t LIMIT 50",
17
+ "maskedFields": ["email"],
18
+ "denyReason": "",
19
+ "receipt": {}
20
+ }
21
+ ```
22
+
23
+ `decision` is `allow` or `deny`. Other fields may be empty strings / `[]` / `{}`.
24
+
25
+ ## Thirty-line sketch
26
+
27
+ ```js
28
+ #!/usr/bin/env node
29
+ import { readFileSync } from 'node:fs'
30
+ import { parseArgs } from 'node:util'
31
+ // import { yourGate } from 'your-product'
32
+
33
+ const { values } = parseArgs({
34
+ options: { policy: { type: 'string' }, query: { type: 'string' } },
35
+ })
36
+ const policy = JSON.parse(readFileSync(values.policy, 'utf8'))
37
+ const sql = readFileSync(values.query, 'utf8')
38
+ try {
39
+ const out = yourGate(policy, sql)
40
+ process.stdout.write(JSON.stringify({
41
+ decision: 'allow',
42
+ rewrittenSql: out.sql || '',
43
+ maskedFields: out.masked || [],
44
+ denyReason: '',
45
+ receipt: {},
46
+ }) + '\n')
47
+ } catch (err) {
48
+ process.stdout.write(JSON.stringify({
49
+ decision: 'deny',
50
+ rewrittenSql: '',
51
+ maskedFields: [],
52
+ denyReason: String(err.message || ''),
53
+ receipt: {},
54
+ }) + '\n')
55
+ }
56
+ ```
57
+
58
+ Receipt-chain cases do not use this adapter. The claims file names a
59
+ verifier command; the runner execs that.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process'
3
+ import { dirname, join } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ const root = join(dirname(fileURLToPath(import.meta.url)), '../..')
7
+ const helper = join(root, 'scripts', 'gacs-query-adapter.mjs')
8
+ const r = spawnSync(process.execPath, [helper, ...process.argv.slice(2)], {
9
+ encoding: 'utf8',
10
+ cwd: root,
11
+ windowsHide: true,
12
+ })
13
+ if (r.stdout) process.stdout.write(r.stdout)
14
+ if (r.status) {
15
+ if (!r.stdout) process.stderr.write(r.stderr || 'query helper failed\n')
16
+ process.exit(r.status)
17
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "coverage/expect-count-pin",
3
+ "regime": "conformance",
4
+ "profile": "GACS-C1",
5
+ "claim": "reconciliation",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/002-chain-of-three/receipts.jsonl",
8
+ "verifyArgs": ["--pubkey", "KEYS/vector-key.pub.pem", "--expect-count", "3"],
9
+ "expectExit": 0,
10
+ "rationale": "A length pin makes a shorter leftover chain fail. The three-receipt vector still verifies when the pin matches.",
11
+ "doesNotTest": "Live comparison against a database's own query counters.",
12
+ "sourceVector": "test-vectors/manifest.json#002-chain-of-three"
13
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "coverage/tail-without-pin",
3
+ "regime": "resistance",
4
+ "profile": "GACS-C1",
5
+ "claim": "reconciliation",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/002-chain-of-three/receipts.jsonl",
8
+ "verifyArgs": ["--pubkey", "KEYS/vector-key.pub.pem"],
9
+ "expectExit": 0,
10
+ "expectedStatus": "DETECTED_WITH_EXTERNAL_PIN",
11
+ "expectedFail": true,
12
+ "rationale": "Without --expect-count / --expect-last-hash / an anchor, a chain that lost its tail still verifies. The pin is the control.",
13
+ "doesNotTest": "A live database counter; this case only shows the receipt file cannot see a missing tail by itself.",
14
+ "sourceVector": "test-vectors/manifest.json#002-chain-of-three"
15
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/001-single-receipt",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/001-single-receipt/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 0,
13
+ "rationale": "One valid signed receipt. The smallest passing case.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#001-single-receipt"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/002-chain-of-three",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/002-chain-of-three/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 0,
13
+ "rationale": "Three receipts linked by prevHash. Contiguous, all signed.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#002-chain-of-three"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/003-tampered-field",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/003-tampered-field/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 10,
13
+ "rationale": "outcome.rows changed from 2 to 999 after signing. The stored hash no longer matches the body.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#003-tampered-field"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/004-prevhash-break",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/004-prevhash-break/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 11,
13
+ "rationale": "The middle receipt of the chain was deleted. #3 points at a hash that is no longer present.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#004-prevhash-break"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/005-seq-gap",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/005-seq-gap/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 12,
13
+ "rationale": "seq jumps 1 -> 7. prevHash still links, so only the counter reveals the gap.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#005-seq-gap"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/006-bad-signature",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/006-bad-signature/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 13,
13
+ "rationale": "First byte of the signature flipped. Body and hash are untouched — only the signature is wrong.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#006-bad-signature"
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/007-schema-invalid",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/007-schema-invalid/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 20,
13
+ "rationale": "policy removed. The verifier must reject the shape before it trusts anything else in the file.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#007-schema-invalid"
16
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "evidence/008-unsigned-no-pubkey",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/008-unsigned-no-pubkey/receipts.jsonl",
8
+ "verifyArgs": [],
9
+ "expectExit": 13,
10
+ "rationale": "An unsigned receipt, verified without --pubkey. Hash and chain are intact, yet the answer is still 13: the verifier never reports success on a signature it did not check.",
11
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
12
+ "sourceVector": "test-vectors/manifest.json#008-unsigned-no-pubkey"
13
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "evidence/009-unsigned-but-pubkey-given",
3
+ "regime": "conformance",
4
+ "profile": "GACS-D1",
5
+ "claim": "receipts",
6
+ "harness": "verify",
7
+ "receipt": "test-vectors/009-unsigned-but-pubkey-given/receipts.jsonl",
8
+ "verifyArgs": [
9
+ "--pubkey",
10
+ "KEYS/vector-key.pub.pem"
11
+ ],
12
+ "expectExit": 13,
13
+ "rationale": "The same unsigned receipt, but the caller asked for signature verification. Fail-closed: a missing signature is not a passing signature.",
14
+ "doesNotTest": "That the records were correct when created; tail truncation without an external pin.",
15
+ "sourceVector": "test-vectors/manifest.json#009-unsigned-but-pubkey-given"
16
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-alias",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT s.id FROM public.secrets AS s",
9
+ "rationale": "A table that is denied (or not allowed) is refused, including through alias, join, CTE, subquery, quoting, and comments.",
10
+ "doesNotTest": "Database-role grants; information_schema contents; dialects other than the postgres spelling used here.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-alias",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-case-fold",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT id FROM PUBLIC.SECRETS",
9
+ "rationale": "A table that is denied (or not allowed) is refused, including through alias, join, CTE, subquery, quoting, and comments.",
10
+ "doesNotTest": "Database-role grants; information_schema contents; dialects other than the postgres spelling used here.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-case-fold",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-comment-between",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT id FROM /* join */ public.secrets",
9
+ "rationale": "A table that is denied (or not allowed) is refused, including through alias, join, CTE, subquery, quoting, and comments.",
10
+ "doesNotTest": "Database-role grants; information_schema contents; dialects other than the postgres spelling used here.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-comment-between",
12
+ "expect": "deny"
13
+ }