@conarium-ai/core 0.2.20 → 0.2.22

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 (103) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/LIMITATIONS.md +30 -0
  3. package/LIMITATIONS.tr.md +16 -0
  4. package/README.md +40 -5
  5. package/SECURITY.md +1 -1
  6. package/bin/conarium-docker-entry.mjs +62 -0
  7. package/bin/conarium-doctor.mjs +59 -2
  8. package/bin/conarium-reconcile.mjs +19 -5
  9. package/bin/conarium-verify.mjs +42 -7
  10. package/conformance/KNOWN-GAPS.md +20 -0
  11. package/conformance/README.md +85 -0
  12. package/conformance/adapters/README.md +59 -0
  13. package/conformance/adapters/conarium.mjs +17 -0
  14. package/conformance/cases/coverage/expect-count-pin.json +13 -0
  15. package/conformance/cases/coverage/tail-without-pin.json +15 -0
  16. package/conformance/cases/evidence/001-single-receipt.json +16 -0
  17. package/conformance/cases/evidence/002-chain-of-three.json +16 -0
  18. package/conformance/cases/evidence/003-tampered-field.json +16 -0
  19. package/conformance/cases/evidence/004-prevhash-break.json +16 -0
  20. package/conformance/cases/evidence/005-seq-gap.json +16 -0
  21. package/conformance/cases/evidence/006-bad-signature.json +16 -0
  22. package/conformance/cases/evidence/007-schema-invalid.json +16 -0
  23. package/conformance/cases/evidence/008-unsigned-no-pubkey.json +13 -0
  24. package/conformance/cases/evidence/009-unsigned-but-pubkey-given.json +16 -0
  25. package/conformance/cases/gate/deny-alias.json +13 -0
  26. package/conformance/cases/gate/deny-case-fold.json +13 -0
  27. package/conformance/cases/gate/deny-comment-between.json +13 -0
  28. package/conformance/cases/gate/deny-cte.json +13 -0
  29. package/conformance/cases/gate/deny-join.json +13 -0
  30. package/conformance/cases/gate/deny-plain.json +13 -0
  31. package/conformance/cases/gate/deny-quoted-lower.json +13 -0
  32. package/conformance/cases/gate/deny-schema-qualify.json +13 -0
  33. package/conformance/cases/gate/deny-string-agg.json +13 -0
  34. package/conformance/cases/gate/deny-subquery.json +13 -0
  35. package/conformance/cases/gate/deny-unqualified.json +13 -0
  36. package/conformance/cases/gate/deny-updlock.json +13 -0
  37. package/conformance/cases/gate/deny-user-fn.json +13 -0
  38. package/conformance/cases/gate/fail-empty.json +13 -0
  39. package/conformance/cases/gate/fail-garbage.json +13 -0
  40. package/conformance/cases/gate/fail-two-statements.json +13 -0
  41. package/conformance/cases/gate/write-copy.json +13 -0
  42. package/conformance/cases/gate/write-create.json +13 -0
  43. package/conformance/cases/gate/write-delete.json +13 -0
  44. package/conformance/cases/gate/write-drop.json +13 -0
  45. package/conformance/cases/gate/write-insert.json +13 -0
  46. package/conformance/cases/gate/write-merge.json +13 -0
  47. package/conformance/cases/gate/write-truncate.json +13 -0
  48. package/conformance/cases/gate/write-update.json +13 -0
  49. package/conformance/cases/inference/cohort-narrowing.json +13 -0
  50. package/conformance/cases/inference/count-channel.json +13 -0
  51. package/conformance/cases/inference/exists-channel.json +13 -0
  52. package/conformance/cases/inference/repeated-probe.json +13 -0
  53. package/conformance/cases/masking/mask-alias.json +14 -0
  54. package/conformance/cases/masking/mask-case.json +14 -0
  55. package/conformance/cases/masking/mask-concat.json +14 -0
  56. package/conformance/cases/masking/mask-subquery.json +14 -0
  57. package/conformance/cases/rowcap/cap-nested.json +14 -0
  58. package/conformance/cases/rowcap/cap-raise-limit.json +14 -0
  59. package/conformance/cases/rowcap/cap-union.json +14 -0
  60. package/conformance/claims/conarium.json +12 -0
  61. package/conformance/lib/status.mjs +48 -0
  62. package/conformance/policies/mask-email.json +5 -0
  63. package/conformance/policies/protected-email.json +6 -0
  64. package/conformance/policies/sql-gate.json +6 -0
  65. package/conformance/profiles.md +15 -0
  66. package/conformance/run.mjs +208 -0
  67. package/conformance/schema/case.json +42 -0
  68. package/dist/audit.d.ts +7 -0
  69. package/dist/audit.d.ts.map +1 -1
  70. package/dist/audit.js +6 -2
  71. package/dist/audit.js.map +1 -1
  72. package/dist/config.d.ts +22 -0
  73. package/dist/config.d.ts.map +1 -1
  74. package/dist/config.js +9 -2
  75. package/dist/config.js.map +1 -1
  76. package/dist/receipt-view.d.ts +5 -0
  77. package/dist/receipt-view.d.ts.map +1 -1
  78. package/dist/receipt-view.js +21 -0
  79. package/dist/receipt-view.js.map +1 -1
  80. package/dist/receipt.d.ts +49 -3
  81. package/dist/receipt.d.ts.map +1 -1
  82. package/dist/receipt.js +46 -3
  83. package/dist/receipt.js.map +1 -1
  84. package/dist/server.d.ts.map +1 -1
  85. package/dist/server.js +12 -2
  86. package/dist/server.js.map +1 -1
  87. package/dist/types.d.ts +7 -0
  88. package/dist/types.d.ts.map +1 -1
  89. package/docs/API-STABILITY.md +7 -6
  90. package/docs/CONTRIBUTING.md +7 -0
  91. package/docs/RECEIPT-SPEC.md +99 -17
  92. package/docs/dogfood/2026-08-06-reconcile.md +8 -0
  93. package/package.json +2 -1
  94. package/scripts/gacs-query-adapter.mjs +52 -0
  95. package/scripts/gen-test-vectors-04.mjs +115 -0
  96. package/scripts/gen-test-vectors.mjs +8 -0
  97. package/test-vectors/010-disclosure-commitment/receipts.jsonl +1 -0
  98. package/test-vectors/011-destination-declared/receipts.jsonl +1 -0
  99. package/test-vectors/012-mixed-chain/receipts.jsonl +2 -0
  100. package/test-vectors/013-disclosure-keys-omitted/receipts.jsonl +1 -0
  101. package/test-vectors/README.md +10 -5
  102. package/test-vectors/expected-hashes.json +24 -0
  103. package/test-vectors/manifest.json +37 -1
@@ -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
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-cte",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "WITH x AS (SELECT id FROM public.secrets) SELECT * FROM x",
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-cte",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-join",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT c.id FROM public.customers c JOIN public.secrets s ON s.id = c.id",
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-join",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-plain",
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-plain",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-quoted-lower",
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-quoted-lower",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-schema-qualify",
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-schema-qualify",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-string-agg",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT STRING_AGG(email, ',') FROM public.customers",
9
+ "rationale": "Serialization and dump aggregates are refused.",
10
+ "doesNotTest": "Leakage through allowed aggregates such as count or avg.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-string-agg",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-subquery",
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 (SELECT id FROM public.secrets) AS x",
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-subquery",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-unqualified",
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 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-unqualified",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-updlock",
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 dbo.customers WITH (UPDLOCK)",
9
+ "rationale": "A locking hint is a side effect and is refused.",
10
+ "doesNotTest": "Session isolation settings applied outside the statement.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-updlock",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/deny-user-fn",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "SELECT app.pkg.fn(id) FROM public.customers",
9
+ "rationale": "Serialization and dump aggregates are refused.",
10
+ "doesNotTest": "Leakage through allowed aggregates such as count or avg.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#deny-user-fn",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/fail-empty",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": " ",
9
+ "rationale": "Unparseable or multi-statement input is refused rather than executed.",
10
+ "doesNotTest": "Parser differences across dialects; the exact error string.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#fail-empty",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/fail-garbage",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "not sql at all !!!",
9
+ "rationale": "Unparseable or multi-statement input is refused rather than executed.",
10
+ "doesNotTest": "Parser differences across dialects; the exact error string.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#fail-garbage",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/fail-two-statements",
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.customers; SELECT id FROM public.secrets",
9
+ "rationale": "Unparseable or multi-statement input is refused rather than executed.",
10
+ "doesNotTest": "Parser differences across dialects; the exact error string.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#fail-two-statements",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-copy",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "COPY public.customers TO STDOUT",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-copy",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-create",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "CREATE TABLE public.x (id int)",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-create",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-delete",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "DELETE FROM public.customers",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-delete",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-drop",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "DROP TABLE public.customers",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-drop",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-insert",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "INSERT INTO public.customers (id) VALUES (1)",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-insert",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-merge",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "MERGE INTO public.customers t USING public.customers s ON t.id = s.id WHEN MATCHED THEN UPDATE SET id = s.id",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-merge",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-truncate",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "TRUNCATE public.customers",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-truncate",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "gate/write-update",
3
+ "regime": "conformance",
4
+ "profile": "GACS-E1",
5
+ "claim": "table-policy",
6
+ "harness": "query",
7
+ "policy": "policies/sql-gate.json",
8
+ "query": "UPDATE public.customers SET id = 1",
9
+ "rationale": "A write token is refused on a read-only gate.",
10
+ "doesNotTest": "Whether the database role itself could execute the write if the gate were bypassed.",
11
+ "sourceVector": "test-vectors/sql-gate/vectors.json#write-update",
12
+ "expect": "deny"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "inference/cohort-narrowing",
3
+ "regime": "resistance",
4
+ "profile": "GACS-I1",
5
+ "claim": "inference-control",
6
+ "harness": "query",
7
+ "policy": "policies/mask-email.json",
8
+ "query": "SELECT city, count(*) FROM public.customers GROUP BY city",
9
+ "expectedStatus": "NOT_COVERED",
10
+ "expectedFail": true,
11
+ "rationale": "Grouping on an allowed column yields cohort sizes. Combined with other filters this narrows identity.",
12
+ "doesNotTest": "Whether a particular cohort is unique in a real table; that needs data."
13
+ }