@conarium-ai/core 0.2.10 → 0.2.11

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 (73) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/LIMITATIONS.md +26 -5
  3. package/LIMITATIONS.tr.md +26 -5
  4. package/README.md +11 -8
  5. package/bin/conarium-doctor.mjs +208 -7
  6. package/bin/doctor-sql.mjs +47 -0
  7. package/dist/config.d.ts +14 -6
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +6 -0
  10. package/dist/config.js.map +1 -1
  11. package/dist/console.d.ts.map +1 -1
  12. package/dist/console.js +14 -3
  13. package/dist/console.js.map +1 -1
  14. package/dist/governance.d.ts +8 -0
  15. package/dist/governance.d.ts.map +1 -1
  16. package/dist/governance.js +29 -78
  17. package/dist/governance.js.map +1 -1
  18. package/dist/masking-cost.d.ts +16 -0
  19. package/dist/masking-cost.d.ts.map +1 -0
  20. package/dist/masking-cost.js +31 -0
  21. package/dist/masking-cost.js.map +1 -0
  22. package/dist/server.d.ts.map +1 -1
  23. package/dist/server.js +3 -1
  24. package/dist/server.js.map +1 -1
  25. package/dist/sql-gate/dispatch.d.ts +17 -0
  26. package/dist/sql-gate/dispatch.d.ts.map +1 -0
  27. package/dist/sql-gate/dispatch.js +30 -0
  28. package/dist/sql-gate/dispatch.js.map +1 -0
  29. package/dist/sql-gate/mssql.d.ts +11 -0
  30. package/dist/sql-gate/mssql.d.ts.map +1 -0
  31. package/dist/sql-gate/mssql.js +287 -0
  32. package/dist/sql-gate/mssql.js.map +1 -0
  33. package/dist/sql-gate/oracle.d.ts +11 -0
  34. package/dist/sql-gate/oracle.d.ts.map +1 -0
  35. package/dist/sql-gate/oracle.js +227 -0
  36. package/dist/sql-gate/oracle.js.map +1 -0
  37. package/dist/sql-gate/postgres.d.ts +12 -0
  38. package/dist/sql-gate/postgres.d.ts.map +1 -0
  39. package/dist/sql-gate/postgres.js +64 -0
  40. package/dist/sql-gate/postgres.js.map +1 -0
  41. package/dist/sql-gate/rules.d.ts +14 -0
  42. package/dist/sql-gate/rules.d.ts.map +1 -0
  43. package/dist/sql-gate/rules.js +73 -0
  44. package/dist/sql-gate/rules.js.map +1 -0
  45. package/dist/sql-gate/types.d.ts +31 -0
  46. package/dist/sql-gate/types.d.ts.map +1 -0
  47. package/dist/sql-gate/types.js +9 -0
  48. package/dist/sql-gate/types.js.map +1 -0
  49. package/dist/types.d.ts +6 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/docs/API-STABILITY.md +174 -0
  52. package/docs/BENCHMARK.md +124 -0
  53. package/docs/audit/2026-08-14-e2e-health.md +69 -0
  54. package/docs/audit/2026-08-14-security-scan.md +48 -0
  55. package/docs/audit/2026-08-14-surface-sync.md +34 -0
  56. package/docs/benchmarks/latest.json +2310 -0
  57. package/docs/benchmarks/masking-cost-threshold.json +6 -0
  58. package/docs/benchmarks/overhead-20260814T1238Z-win32.json +402 -0
  59. package/docs/benchmarks/overhead-20260814T1346Z-linux.json +2310 -0
  60. package/docs/benchmarks/overhead-20260814T1644Z-win32.json +2310 -0
  61. package/docs/releases/v0.2.10.md +24 -0
  62. package/docs/releases/v0.2.8.md +23 -0
  63. package/docs/releases/v0.2.9.md +26 -0
  64. package/docs/security/PENTEST-SCOPE.md +1 -1
  65. package/docs/security/THREAT-MODEL.md +7 -5
  66. package/docs/specs/2026-08-14-mssql-bypass-inventory.md +37 -0
  67. package/docs/specs/2026-08-14-oracle-bypass-inventory.md +28 -0
  68. package/package.json +5 -2
  69. package/scripts/benchmark-overhead.mjs +492 -0
  70. package/test-vectors/README.md +3 -0
  71. package/test-vectors/sql-gate/LAST-RUN.json +11 -0
  72. package/test-vectors/sql-gate/README.md +19 -0
  73. package/test-vectors/sql-gate/vectors.json +331 -0
@@ -0,0 +1,24 @@
1
+ # Draft — Conarium 0.2.10
2
+
3
+ **Taslak.** GitHub Release yayımlanmadı. Tag `v0.2.10` = `a21fdca`.
4
+ This is the npm / Hetzner / tag line as of 2026-08-14.
5
+
6
+ ## Added
7
+
8
+ - `LIMITATIONS.md` and `LIMITATIONS.tr.md`. What this repository has not done.
9
+ - Built-in OpenTimestamps client. `javascript-opentimestamps` is not a
10
+ dependency. The `web3` / `request` / `bitcore` tree is not installed.
11
+
12
+ ## Changed
13
+
14
+ - `COMPARISON.md` removed from this repository. The dated comparison lives
15
+ only at `conarium.dev/compare.html`.
16
+ - `test:checks` runs every check even if one fails.
17
+
18
+ ## Docs
19
+
20
+ - Threat model and pentest scope under `docs/security/`.
21
+
22
+ Commits after this tag (benchmark, maxRows note) are not part of 0.2.10.
23
+
24
+ Not a dialect release. SQL remains Postgres only.
@@ -0,0 +1,23 @@
1
+ # Draft — Conarium 0.2.8
2
+
3
+ **Taslak.** GitHub Release yayımlanmadı. Tag `v0.2.8` = `ea563b9`.
4
+
5
+ Console grows a desktop launcher and a receipts tab. The public demo stops
6
+ breaking MCP clients that probe `/.well-known/*`.
7
+
8
+ ## Added
9
+
10
+ - `conarium-console --install-shortcut` / `--uninstall-shortcut`. Opens the
11
+ existing loopback console after the port listens. Browser gets a one-time
12
+ `/handoff` nonce (≤30s). The long-lived token is not put in the URL.
13
+ - Console **Makbuzlar** tab: lists `audit.receiptSink` newest-first, opens the
14
+ same receipt HTML as `/proof`, shows zincir sağlam / kırık. Renderer is
15
+ `src/receipt-view.ts`.
16
+
17
+ ## Fixed
18
+
19
+ - HTTP gateway returns 404 (plain text) for `/.well-known/*`. A 302+HTML
20
+ catch-all made some MCP clients treat the redirect body as authorization
21
+ metadata. Caddy must still 404 these paths first.
22
+
23
+ Not a dialect release. SQL remains Postgres only.
@@ -0,0 +1,26 @@
1
+ # Draft — Conarium 0.2.9
2
+
3
+ **Taslak.** GitHub Release yayımlanmadı. Tag `v0.2.9` = `73f7a86`.
4
+
5
+ Operator-facing console and proof page, plus a config-time custom PII
6
+ pattern. A design note for Oracle/MSSQL exists; there is no dialect code.
7
+
8
+ ## Added
9
+
10
+ - Custom PII pattern from config. ReDoS-shaped input is rejected at compile.
11
+ - Desktop / panel mark from the existing SVG (`.ico` / `.icns` / 512 PNG).
12
+ - `c1` sets `CONARIUM_AUDIT_SIGNING_KEY` from `~/.conarium/audit-ed25519.pem`
13
+ when `receiptSink` is set. The sink file is not invented empty.
14
+
15
+ ## Fixed
16
+
17
+ - `/proof` HTML shows known English sentences in Turkish. JSON bytes unchanged.
18
+ - Makbuzlar tab paints "Yükleniyor…" on the click that switches the tab.
19
+ - Receipt download returns bytes; file name is sanitised.
20
+
21
+ ## Docs
22
+
23
+ - `docs/specs/2026-08-14-oracle-mssql-dialect-design.md` — design only.
24
+ Oracle, MSSQL, and MySQL are not implemented.
25
+
26
+ Not a dialect release. SQL remains Postgres only.
@@ -74,7 +74,7 @@ the first hour spent rediscovering them.
74
74
 
75
75
  1. No SOC 2, no ISO, no independent pentest. (`LIMITATIONS.md`)
76
76
  2. Not 1.0. API can break.
77
- 3. SQL is Postgres only.
77
+ 3. SQL is Postgres, Microsoft SQL Server, and Oracle. MySQL is not implemented. Oracle synonyms and database links are not resolved.
78
78
  4. Bare names and street addresses in free text are not detected.
79
79
  5. One production install; 121,366 is that company's ERP and is not
80
80
  externally verifiable.
@@ -52,8 +52,10 @@ Every tool call — allowed or denied — is supposed to write a signed receipt.
52
52
 
53
53
  ### 2. Gateway ↔ database
54
54
 
55
- **Today:** Connectors are read-only. `Governance.guardQuery` rejects writes,
56
- multi-statement, and unknown AST. Row cap is applied in the engine.
55
+ **Today:** Connectors are read-only. The shipped `query` tool selects the
56
+ SQL gate from `policy.dialect` (omitted = postgres / `Governance.guardQuery`).
57
+ The dialect is not inferred from the statement. Writes, multi-statement, and
58
+ unknown AST are rejected. Row cap is applied in the engine.
57
59
  Supabase REST and docs connectors have their own read-only paths.
58
60
 
59
61
  **Bypass surface:**
@@ -64,9 +66,9 @@ Supabase REST and docs connectors have their own read-only paths.
64
66
  - OpenAPI connector: DNS rebinding / TOCTOU between `enforceSafeRemoteUrl`
65
67
  and `fetch` is **accepted, not fixed** (`SECURITY.md`). Exploit requires an
66
68
  operator-authored `allowedBaseUrls` entry under attacker control.
67
- - SQL dialect is Postgres only. A query the parser does not understand is
68
- denied — unless a future dialect is added badly, in which case the gate
69
- fails open on that dialect. There is no second dialect in code.
69
+ - SQL dialects are Postgres, Microsoft SQL Server, and Oracle. A query
70
+ the parser does not understand is denied. MySQL is not implemented.
71
+ Oracle synonyms are not resolved; `table@dblink` is denied.
70
72
 
71
73
  ### 3. Console ↔ operator
72
74
 
@@ -0,0 +1,37 @@
1
+ # MSSQL — bugünkü (Postgres) koruma nasıl atlatılır
2
+
3
+ Kod yokken, `pgsql-ast-parser` + `WRITE_TOKENS` ile T-SQL okunursa.
4
+ Bu belge D’den önce yazıldı. Destek iddiası değil.
5
+
6
+ | Fark | Atlatma (parser Postgres varsayarsa) | Bu turdaki kural |
7
+ |---|---|---|
8
+ | Köşeli parantez `[Customers]` | Postgres tırnak kuralı `[` görmez. `[secrets]` string veya bilinmeyen token olabilir. | Parantezli ad çözülür; 3–4 parça ve linked server **deny**. |
9
+ | `TOP` vs `LIMIT` | `LIMIT` yok diye satır tavanı sessizce uygulanmaz. `TOP 100 PERCENT` tavan değil. | `TOP 100 PERCENT` **deny**. `TOP n` n>cap ise cap’e çekilir. Yoksa `TOP (cap)` eklenir. |
10
+ | Şema / sahip `dbo` | `public.customers` allow-list `dbo.customers` ile eşleşmez (ters hata) veya 4 parça düşer. | MSSQL politikası `dbo.*`. `server.db.schema.table` **deny**. Niteliksiz **deny**. |
11
+ | `GO` | Batch ayırıcı; parser tek SELECT görüp gerisini yutabilir. | `\bGO\b` **deny**. |
12
+ | `;` çok ifade | İkinci ifade yazma olabilir. | Birden fazla ifade **deny**. |
13
+ | `xp_*` / `sp_*` | Fonksiyon allow-list Postgres adları. `xp_cmdshell` geçer gibi durur. | `xp_` / `sp_` **deny** (parse öncesi). |
14
+ | `OPENROWSET` / `OPENQUERY` | Tablo gibi durur; `inspectFunction` görmez. | İsim **deny**. |
15
+ | `FOR XML` / `FOR JSON` | SELECT soneki, fonksiyon değil. | **deny**. |
16
+ | `EXEC` / `EXECUTE` | `\bCALL\b` yakalamaz. | **deny**. |
17
+ | Yorum / string | `--` ve `/* */` Postgres ile aynı sınıf; kaçış `]` `]]`. | Parse başarısız → **deny**. |
18
+
19
+ **Ayrıştırıcı:** `node-sql-parser` (yalnız `transactsql` build).
20
+ Gerekçe: T-SQL AST + sqlify. Bakım riski: Microsoft parser’ı değil; PEG. Bilmediği düğüm **deny**, “bilmiyorum = izin” yok.
21
+
22
+ ## Parser’ın kabul edip kapının reddettiği (bu turda bulundu)
23
+
24
+ Savunma gevşetilmedi. Pre-deny / tip kontrolü şart:
25
+
26
+ | Girdi | Parser | Kapı |
27
+ |---|---|---|
28
+ | `… customers GO` | parse OK; `GO` tablo takma adı oluyor | `\bGO\b` deny |
29
+ | `OPENROWSET` | parse OK; `tableList` **boş** | isim deny (yalnız tableList = sessiz atlatma) |
30
+ | `not sql` (kısa) | parse OK; `type: assign` | select olmayan tip deny |
31
+ | `not sql at all !!!` | parse fail | parse fail → deny |
32
+ | `SELECT …; SELECT 1` | ast dizi uzunluğu 2 | çok ifade deny |
33
+ | `TOP 100 PERCENT` | parse OK | PERCENT deny |
34
+ | `SELECT id INTO x …` | parse OK | `into.type === 'into'` deny |
35
+ | 4 parça `server.db.dbo.t` | parse OK | `server` / 3+ parça deny |
36
+
37
+ UNION’da `TOP` yalnız ilk SELECT’e biner. Kapı UNION’ı `SELECT TOP n * FROM (… )` ile sarar.
@@ -0,0 +1,28 @@
1
+ # Oracle — bugünkü (Postgres) koruma nasıl atlatılır
2
+
3
+ Kod yokken, `pgsql-ast-parser` + `WRITE_TOKENS` ile Oracle SQL okunursa.
4
+ Bu belge E’den önce yazıldı. Destek iddiası değil.
5
+
6
+ | Fark | Atlatma (parser Postgres varsayarsa) | Bu turdaki kural |
7
+ |---|---|---|
8
+ | Tırnak / büyük-küçük | Oracle tırnaksız adı UPPER fold eder. `"secrets"` ≠ `SECRETS`. Postgres tırnak kuralı yanlış eşleşir. | Fold + tırnaklı ad çözülür; niteliksiz **deny**. |
9
+ | Şema = kullanıcı | `public.customers` allow-list `APP.CUSTOMERS` ile eşleşmez. | Oracle politikası `app.*`. |
10
+ | `ROWNUM` / `FETCH FIRST` | `LIMIT` yok diye tavan sessizce uygulanmaz. `ROWNUM <= 9999` tavan değil. | `FETCH FIRST n ROWS ONLY` n>cap ise cap. `ROWNUM` **deny** (satır tavanı değil, predicate). |
11
+ | Analitik / pencere | `ROW_NUMBER() OVER` ile dışarıdan LIMIT taklidi. | Pencere fonksiyonu satır tavanı sayılmaz; dış `FETCH FIRST` zorunlu. |
12
+ | `UTL_*` / `DBMS_*` | Fonksiyon allow-list Postgres adları. Ağ/dosya çağrısı geçer gibi durur. | `UTL_` / `DBMS_` **deny** (parse öncesi). |
13
+ | `BEGIN…END` | Anonim blok; parser SELECT görmeyebilir veya yutabilir. | SELECT/WITH olmayan **deny**. |
14
+ | Yorum / string | `--` `/* */` q-quote `q'!...!'`. | Parse başarısız → **deny**. |
15
+ | Synonym | Parser taban tabloyu görmez; allow-list synonym adına bakar. | **Kapanmaz.** Operatör allow-list’e koyduğu adı görür, hedefi değil. LIMITATIONS’ta dürüst kal. |
16
+ | DB link `table@dblink` | Uzak tablo yerel gibi durur. | `@` **deny**. |
17
+
18
+ **Ayrıştırıcı:** `node-sql-parser` 5.4.0’da Oracle build **yok**.
19
+ Bunun yerine `@guanmingchiu/sqlparser-ts` 0.62 (`sqlparser-rs` WASM, lehçe `oracle`).
20
+ Gerekçe: gerçek Oracle AST. Bakım: genç sarmalayıcı, upstream Apache sqlparser-rs.
21
+ `format()` AST→SQL bu sürümde çalışmıyor; satır tavanı orijinal SQL’i `FETCH FIRST n` ile sarar.
22
+ Bilmediği girdi **deny**. Synonym hedefi **kapanmaz**.
23
+
24
+ ## Canlı örnek (kabul 2) — 2026-08-14 19:36
25
+
26
+ İlk tur: `--memory=2g` + init sırasında exec/stop. Log: `CONTAINER: shutdown request received` (SIGTERM). `OOMKilled=false`. Yarım init → `ORA-01109`.
27
+ Bu tur: bellek tavanı yok, `--shm-size=1g`, named volume, init bitene kadar dokunulmadı. ~1 dk’da `DATABASE IS READY TO USE` + `APP_USER`. `PASS oracle-live`: 80→50, secrets dolu+deny, garbage deny.
28
+ Emit: `_conarium_cap` Oracle’da yasadışı tanımlayıcı (`ORA-00911`); `conarium_cap` oldu.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conarium-ai/core",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "//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.",
5
5
  "//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.",
6
6
  "files": [
@@ -79,13 +79,16 @@
79
79
  "start": "node dist/index.js",
80
80
  "lint": "tsc --noEmit",
81
81
  "prepublishOnly": "npm run build",
82
- "test:vectors": "node test/vectors_run.mjs"
82
+ "test:vectors": "node test/vectors_run.mjs",
83
+ "bench:overhead": "node scripts/benchmark-overhead.mjs"
83
84
  },
84
85
  "dependencies": {
86
+ "@guanmingchiu/sqlparser-ts": "^0.62.0",
85
87
  "@modelcontextprotocol/sdk": "^1.0.0",
86
88
  "express": "^5.2.1",
87
89
  "js-yaml": "^5.2.3",
88
90
  "node-fetch": "^3.3.2",
91
+ "node-sql-parser": "^5.4.0",
89
92
  "pgsql-ast-parser": "^12.0.2",
90
93
  "postgres": "^3.4.4",
91
94
  "zod": "^3.23.8"