@conarium-ai/core 0.2.9 → 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.
- package/CHANGELOG.md +30 -0
- package/LIMITATIONS.md +70 -0
- package/LIMITATIONS.tr.md +70 -0
- package/README.md +20 -8
- package/SECURITY.md +14 -0
- package/bin/conarium-anchor-upgrade.mjs +10 -43
- package/bin/conarium-doctor.mjs +221 -24
- package/bin/conarium-stamp.mjs +4 -13
- package/bin/conarium-verify.mjs +13 -62
- package/bin/doctor-sql.mjs +47 -0
- package/deploy/anchor-service/README.md +3 -4
- package/dist/anchor-service.d.ts.map +1 -1
- package/dist/anchor-service.js +11 -26
- package/dist/anchor-service.js.map +1 -1
- package/dist/anchor.d.ts +6 -31
- package/dist/anchor.d.ts.map +1 -1
- package/dist/anchor.js +15 -65
- package/dist/anchor.js.map +1 -1
- package/dist/config.d.ts +14 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +14 -3
- package/dist/console.js.map +1 -1
- package/dist/governance.d.ts +8 -0
- package/dist/governance.d.ts.map +1 -1
- package/dist/governance.js +29 -78
- package/dist/governance.js.map +1 -1
- package/dist/masking-cost.d.ts +16 -0
- package/dist/masking-cost.d.ts.map +1 -0
- package/dist/masking-cost.js +31 -0
- package/dist/masking-cost.js.map +1 -0
- package/dist/ots/calendar.d.ts +11 -0
- package/dist/ots/calendar.d.ts.map +1 -0
- package/dist/ots/calendar.js +93 -0
- package/dist/ots/calendar.js.map +1 -0
- package/dist/ots/client.d.ts +29 -0
- package/dist/ots/client.d.ts.map +1 -0
- package/dist/ots/client.js +102 -0
- package/dist/ots/client.js.map +1 -0
- package/dist/ots/codec.d.ts +26 -0
- package/dist/ots/codec.d.ts.map +1 -0
- package/dist/ots/codec.js +92 -0
- package/dist/ots/codec.js.map +1 -0
- package/dist/ots/format.d.ts +60 -0
- package/dist/ots/format.d.ts.map +1 -0
- package/dist/ots/format.js +232 -0
- package/dist/ots/format.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -1
- package/dist/server.js.map +1 -1
- package/dist/sql-gate/dispatch.d.ts +17 -0
- package/dist/sql-gate/dispatch.d.ts.map +1 -0
- package/dist/sql-gate/dispatch.js +30 -0
- package/dist/sql-gate/dispatch.js.map +1 -0
- package/dist/sql-gate/mssql.d.ts +11 -0
- package/dist/sql-gate/mssql.d.ts.map +1 -0
- package/dist/sql-gate/mssql.js +287 -0
- package/dist/sql-gate/mssql.js.map +1 -0
- package/dist/sql-gate/oracle.d.ts +11 -0
- package/dist/sql-gate/oracle.d.ts.map +1 -0
- package/dist/sql-gate/oracle.js +227 -0
- package/dist/sql-gate/oracle.js.map +1 -0
- package/dist/sql-gate/postgres.d.ts +12 -0
- package/dist/sql-gate/postgres.d.ts.map +1 -0
- package/dist/sql-gate/postgres.js +64 -0
- package/dist/sql-gate/postgres.js.map +1 -0
- package/dist/sql-gate/rules.d.ts +14 -0
- package/dist/sql-gate/rules.d.ts.map +1 -0
- package/dist/sql-gate/rules.js +73 -0
- package/dist/sql-gate/rules.js.map +1 -0
- package/dist/sql-gate/types.d.ts +31 -0
- package/dist/sql-gate/types.d.ts.map +1 -0
- package/dist/sql-gate/types.js +9 -0
- package/dist/sql-gate/types.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/API-STABILITY.md +174 -0
- package/docs/BENCHMARK.md +124 -0
- package/docs/audit/2026-08-14-e2e-health.md +69 -0
- package/docs/audit/2026-08-14-security-scan.md +48 -0
- package/docs/audit/2026-08-14-surface-sync.md +34 -0
- package/docs/benchmarks/latest.json +2310 -0
- package/docs/benchmarks/masking-cost-threshold.json +6 -0
- package/docs/benchmarks/overhead-20260814T1238Z-win32.json +402 -0
- package/docs/benchmarks/overhead-20260814T1346Z-linux.json +2310 -0
- package/docs/benchmarks/overhead-20260814T1644Z-win32.json +2310 -0
- package/docs/releases/v0.2.10.md +24 -0
- package/docs/releases/v0.2.8.md +23 -0
- package/docs/releases/v0.2.9.md +26 -0
- package/docs/security/PENTEST-SCOPE.md +90 -0
- package/docs/security/THREAT-MODEL.md +118 -0
- package/docs/specs/2026-08-14-mssql-bypass-inventory.md +37 -0
- package/docs/specs/2026-08-14-oracle-bypass-inventory.md +28 -0
- package/package.json +9 -13
- package/scripts/benchmark-overhead.mjs +492 -0
- package/test-vectors/README.md +3 -0
- package/test-vectors/sql-gate/LAST-RUN.json +11 -0
- package/test-vectors/sql-gate/README.md +19 -0
- 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.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Penetration-test scope
|
|
2
|
+
|
|
3
|
+
Hand this to an external tester on day one. It is a map, not a certificate.
|
|
4
|
+
There is **no independent pentest on file**. Completing this document does
|
|
5
|
+
not change that.
|
|
6
|
+
|
|
7
|
+
English only. No price, no duration, no firm names.
|
|
8
|
+
|
|
9
|
+
## In scope
|
|
10
|
+
|
|
11
|
+
| Surface | What to hit | Expected behaviour (violation = finding) |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| MCP stdio / HTTP | `query`, `list_tables`, `describe_table`, `search` | Denied table → deny + receipt. Write SQL → refuse. Multi-statement → refuse. Row cap applied. Masked columns never reach the model in the clear. |
|
|
14
|
+
| SQL gate | UNION, quoted identifiers, function calls, `; DROP`, comments | Parser + `guardQuery` reject writes and unknown shape. A query that returns a denied table's data is a finding. |
|
|
15
|
+
| Receipt chain | Edit a line, swap two lines, delete a middle line, delete the tail, strip `sig` | `conarium-verify --pubkey` exits 10/11/12/13 as documented in `docs/RECEIPT-SPEC.md`. Tail delete **without** `--expect-count` exiting 0 is documented, not a finding. Tail delete **with** `--expect-count` exiting 0 is a finding. |
|
|
16
|
+
| Console | Auth, CSRF, session cookie, rate limit, config save | No token → 401/403. CSRF missing on cookie POST → 403. Rate limit before auth. Half-written config after crash is a finding. Bind default is `127.0.0.1`; a default bind on `0.0.0.0` is a finding. |
|
|
17
|
+
| Config loader | Missing file, empty `allowConnectors`, broken JSON, ReDoS-shaped `customPatterns` | Missing file → gateway starts empty (documented; doctor must flag it). Empty `allowConnectors` → deny all / refuse boot. Broken pattern → config rejected. |
|
|
18
|
+
| HTTP sessions | Reuse `Mcp-Session-Id` with a *different* valid token | 403. Same token → proceed. `test/session_owner.test.mjs`. |
|
|
19
|
+
| OpenAPI connector | SSRF / private-range redirect | HTTPS required. Host must be on `allowedBaseUrls`. DNS rebinding TOCTOU is a **known accepted gap** — see `SECURITY.md`. Report it if you can exploit it without an operator-controlled hostname; that would upgrade the finding. |
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
|
|
23
|
+
- The operator's Postgres (or other) server itself.
|
|
24
|
+
- OS / hypervisor / physical access.
|
|
25
|
+
- Social engineering of the one-person team.
|
|
26
|
+
- Denial-of-service against public OpenTimestamps calendars or `blockstream.info`.
|
|
27
|
+
- Asking the model to "ignore previous instructions" as a *product* finding
|
|
28
|
+
unless it produces a policy bypass in the gateway (the model is not the gate).
|
|
29
|
+
|
|
30
|
+
## How to stand it up (first morning)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/dogrucanemek-alt/conarium.git
|
|
34
|
+
cd conarium
|
|
35
|
+
npm ci
|
|
36
|
+
npm run build
|
|
37
|
+
npx tsc --noEmit
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Write a throwaway config with `npx conarium-init --out /tmp/cnr-pt`.
|
|
41
|
+
Point the Postgres URL at a **disposable** database you control.
|
|
42
|
+
Fill `policy.allowTables`. Export `CONARIUM_AUDIT_SIGNING_KEY`.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx conarium-doctor --config /tmp/cnr-pt/conarium.config.json --no-net
|
|
46
|
+
# stdio MCP
|
|
47
|
+
npx conarium --config /tmp/cnr-pt/conarium.config.json
|
|
48
|
+
# console (loopback)
|
|
49
|
+
CONARIUM_CONSOLE_TOKEN='<≥24 chars>' npx conarium-console
|
|
50
|
+
# HTTP gateway
|
|
51
|
+
CONARIUM_MCP_TOKEN='<≥24 chars>' npx conarium --http --config /tmp/cnr-pt/conarium.config.json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Do not point this at a production ERP. The only production install this
|
|
55
|
+
project has is the author's company; it is not a test target.
|
|
56
|
+
|
|
57
|
+
## Tests already in the repo — do not redo from zero
|
|
58
|
+
|
|
59
|
+
| Suite | Command | What it already covers |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| Unit | `npx vitest run` | Governance, masking, receipts, sessions, rate limit, custom patterns |
|
|
62
|
+
| Adversarial checks | `npm run test:checks` | Doctor, console auth/CSRF/handoff, init, pack leak, connectors, lineage, hardening, OTS fixtures, vectors, HTTP e2e |
|
|
63
|
+
| Conformance vectors | `npm run test:vectors` | Frozen receipt cases + expected exit codes in `test-vectors/manifest.json` |
|
|
64
|
+
| Red team | `npx vitest run redteam` | Query-time and result-time attacks (`redteam/attacks/`) |
|
|
65
|
+
| Receipt spec | `docs/RECEIPT-SPEC.md` | Exit codes 0, 10–15, 20, 40, 50 |
|
|
66
|
+
|
|
67
|
+
A finding that is already asserted in one of those files is a **regression**,
|
|
68
|
+
not a new class. Cite the test.
|
|
69
|
+
|
|
70
|
+
## Known documented gaps (do not bill as discovery)
|
|
71
|
+
|
|
72
|
+
These are already written down. Confirm they are still true; do not invoice
|
|
73
|
+
the first hour spent rediscovering them.
|
|
74
|
+
|
|
75
|
+
1. No SOC 2, no ISO, no independent pentest. (`LIMITATIONS.md`)
|
|
76
|
+
2. Not 1.0. API can break.
|
|
77
|
+
3. SQL is Postgres, Microsoft SQL Server, and Oracle. MySQL is not implemented. Oracle synonyms and database links are not resolved.
|
|
78
|
+
4. Bare names and street addresses in free text are not detected.
|
|
79
|
+
5. One production install; 121,366 is that company's ERP and is not
|
|
80
|
+
externally verifiable.
|
|
81
|
+
6. Bus factor 1. Cryptography not formally audited.
|
|
82
|
+
7. Receipt tail truncation is invisible without an external pin.
|
|
83
|
+
8. OpenAPI DNS rebinding TOCTOU, accepted (`SECURITY.md`).
|
|
84
|
+
9. OpenTimestamps pending ≠ Bitcoin-confirmed. Explorer unreachable → 15.
|
|
85
|
+
|
|
86
|
+
## Reporting
|
|
87
|
+
|
|
88
|
+
Email **e.dogru@conarium.dev**. Include a reproduction. There is no bounty.
|
|
89
|
+
A report that says "we found no issues" is not an audit substitute and will
|
|
90
|
+
not be quoted as one.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Threat model
|
|
2
|
+
|
|
3
|
+
What an attacker can try. Not a sales page. Not an audit.
|
|
4
|
+
There is **no independent penetration test**. This document does not change that.
|
|
5
|
+
|
|
6
|
+
Measured against this repository (Conarium 0.2.x). Dates are when a fact was
|
|
7
|
+
recorded, not promises.
|
|
8
|
+
|
|
9
|
+
## Assets
|
|
10
|
+
|
|
11
|
+
| Asset | Why it matters | Where it lives |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Customer PII / secrets in the database | The product exists to keep these off the model | Operator's Postgres (and other connectors) |
|
|
14
|
+
| Policy (allow/deny/mask/row-cap) | Whoever writes this decides what the model sees | `conarium.config.json`, console save path |
|
|
15
|
+
| Ed25519 signing key | Forges receipts if stolen | `audit-ed25519.pem` (mode 0600 where the OS allows) |
|
|
16
|
+
| Receipt / audit chain | Evidence of what was allowed, denied, masked | `audit.sink`, `audit.receiptSink` |
|
|
17
|
+
| Per-user tokens | Bind a person to a masking profile | `CONARIUM_TOKENS_FILE` / `conarium.tokens.json` |
|
|
18
|
+
| Console token | Opens the policy editor | `CONARIUM_CONSOLE_TOKEN`, `~/.conarium/console.token` |
|
|
19
|
+
| MCP token | Opens the HTTP gateway | `CONARIUM_MCP_TOKEN` |
|
|
20
|
+
|
|
21
|
+
## Actors
|
|
22
|
+
|
|
23
|
+
| Actor | Intent |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Honest developer | Uses Cursor/Copilot through the gateway as designed |
|
|
26
|
+
| Manipulated AI agent | Follows a prompt that tries to read denied tables, dump rows, or smuggle PII in free text |
|
|
27
|
+
| Malicious insider | Holds a valid token or the config; wants to widen policy or rewrite history |
|
|
28
|
+
| Process that bypasses the gateway | Connects to the database with the same or another credential, never through Conarium |
|
|
29
|
+
| Attacker on the console / HTTP port | Reaches loopback or a mis-bound interface; tries auth, CSRF, session swap |
|
|
30
|
+
|
|
31
|
+
A compromised operator is in scope as an actor and **out of scope as a defence**.
|
|
32
|
+
Whoever controls the config controls the policy. The code cannot save you from yourself.
|
|
33
|
+
|
|
34
|
+
## Trust boundaries
|
|
35
|
+
|
|
36
|
+
### 1. AI assistant ↔ gateway
|
|
37
|
+
|
|
38
|
+
**Today:** MCP stdio or Streamable HTTP. SQL is parsed (`pgsql-ast-parser`), not grepped.
|
|
39
|
+
Writes are refused by the connector. Tables not on `allowTables` are denied.
|
|
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.
|
|
42
|
+
|
|
43
|
+
**Bypass surface:**
|
|
44
|
+
- A bare name in running prose is not detected. "Ahmet called" goes through.
|
|
45
|
+
- Street addresses are not detected.
|
|
46
|
+
- Passport numbers in free text (non-MRZ) are not detected.
|
|
47
|
+
- `allowTools` is fail-**open** when unset. Table policy is the real gate.
|
|
48
|
+
- HTTP sessions were once routable by `Mcp-Session-Id` alone (fixed 2026-08-12:
|
|
49
|
+
bound to a hash of the opening credential). Regression: `test/session_owner.test.mjs`.
|
|
50
|
+
- A missing config file does **not** stop the gateway. It starts with zero
|
|
51
|
+
connectors and governs nothing. `conarium-doctor` exists because of this.
|
|
52
|
+
|
|
53
|
+
### 2. Gateway ↔ database
|
|
54
|
+
|
|
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.
|
|
59
|
+
Supabase REST and docs connectors have their own read-only paths.
|
|
60
|
+
|
|
61
|
+
**Bypass surface:**
|
|
62
|
+
- The database credential, once leaked, is a path around the gateway.
|
|
63
|
+
Conarium is not a firewall.
|
|
64
|
+
- `pg_stat_statements` reconciliation trusts the database's own counters.
|
|
65
|
+
An attacker who can falsify those counters is out of scope.
|
|
66
|
+
- OpenAPI connector: DNS rebinding / TOCTOU between `enforceSafeRemoteUrl`
|
|
67
|
+
and `fetch` is **accepted, not fixed** (`SECURITY.md`). Exploit requires an
|
|
68
|
+
operator-authored `allowedBaseUrls` entry under attacker control.
|
|
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.
|
|
72
|
+
|
|
73
|
+
### 3. Console ↔ operator
|
|
74
|
+
|
|
75
|
+
**Today:** Binds `127.0.0.1`. Token required. CSRF token on cookie sessions.
|
|
76
|
+
Rate limit runs **before** auth (the token is the thing being protected).
|
|
77
|
+
Config save is temp-file + `rename` in the same directory.
|
|
78
|
+
|
|
79
|
+
**Bypass surface:**
|
|
80
|
+
- Loopback is not a security boundary on a shared machine.
|
|
81
|
+
- `CONARIUM_CONSOLE_TOKEN` in the environment is as strong as the operator's
|
|
82
|
+
process list and shell history.
|
|
83
|
+
- The desktop shortcut stores the token in `~/.conarium/console.token` (0600).
|
|
84
|
+
Another local account that can read that file is the operator.
|
|
85
|
+
- Chat proxy (`api/chat.js`): anonymous access requires explicit
|
|
86
|
+
`CONARIUM_CHAT_PUBLIC=1`; missing config is 503, not "public".
|
|
87
|
+
|
|
88
|
+
### 4. Receipt file ↔ auditor
|
|
89
|
+
|
|
90
|
+
**Today:** Ed25519 + hash chain. `conarium-verify` imports nothing from `src/`.
|
|
91
|
+
Middle-gap deletion fails. Tail truncation does **not** fail unless
|
|
92
|
+
`--expect-count` / `--expect-last-hash` or an external anchor / reconcile.
|
|
93
|
+
Pending OpenTimestamps is disclosed as `pending`. Bitcoin upgrade is hours later.
|
|
94
|
+
|
|
95
|
+
**Bypass surface:**
|
|
96
|
+
- An operator can write false-but-well-formed receipts *before* anchoring.
|
|
97
|
+
Creation-time truth is not proven.
|
|
98
|
+
- `{hash, sig, anchor}` are excluded from the content hash. Ed25519-only
|
|
99
|
+
strip-all can pass a boot check; Ed25519 + HMAC catches it.
|
|
100
|
+
- A shorter leftover chain still verifies. That is structural, not a bug.
|
|
101
|
+
- Anchor calendars and `blockstream.info` are third parties. Unreachable →
|
|
102
|
+
exit 15 ("could not check"), not exit 0.
|
|
103
|
+
|
|
104
|
+
## Out of scope (stated so nobody bills hours here)
|
|
105
|
+
|
|
106
|
+
- The database's own authentication, authorization, encryption, backups.
|
|
107
|
+
- The operating system, disk encryption, process isolation, file permissions
|
|
108
|
+
beyond what this process sets on keys it writes.
|
|
109
|
+
- The network path in front of a reverse proxy (TLS, WAF, VPN).
|
|
110
|
+
- Hardware key storage (HSM, TPM, OS keychain). The signing key is a PEM file.
|
|
111
|
+
- The model leaking data it was *allowed* to see.
|
|
112
|
+
- An attacker who already has the operator's shell.
|
|
113
|
+
|
|
114
|
+
## What this document is not
|
|
115
|
+
|
|
116
|
+
It is not a pentest. It is not SOC 2. It is not a claim that the surfaces
|
|
117
|
+
above are closed. It is the list we would hand a tester so they spend time
|
|
118
|
+
on the weak points instead of rediscovering the product.
|
|
@@ -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.
|
|
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": [
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"README.md",
|
|
26
26
|
"LICENSE",
|
|
27
27
|
"SECURITY.md",
|
|
28
|
+
"LIMITATIONS.md",
|
|
29
|
+
"LIMITATIONS.tr.md",
|
|
28
30
|
"CHANGELOG.md"
|
|
29
31
|
],
|
|
30
32
|
"description": "Governed MCP gateway for AI data access: policy enforcement and PII masking, an Ed25519-signed receipt per access that a third party verifies offline, coverage reconciliation against the database's own query counters to surface access that bypassed the gateway, and conformance vectors so the receipt format can be implemented without us. Self-hosted, MIT.",
|
|
@@ -71,19 +73,22 @@
|
|
|
71
73
|
"build": "tsc",
|
|
72
74
|
"test": "vitest run",
|
|
73
75
|
"test:anchor-verify": "npm run build && node test/anchor_verify.mjs",
|
|
74
|
-
"test:checks": "npm run build && node test/
|
|
76
|
+
"test:checks": "npm run build && node test/run-checks.mjs",
|
|
75
77
|
"test:all": "npm run lint && npm run test && npm run test:checks",
|
|
76
78
|
"dev": "tsx watch src/index.ts",
|
|
77
79
|
"start": "node dist/index.js",
|
|
78
80
|
"lint": "tsc --noEmit",
|
|
79
81
|
"prepublishOnly": "npm run build",
|
|
80
|
-
"test:vectors": "node test/vectors_run.mjs"
|
|
82
|
+
"test:vectors": "node test/vectors_run.mjs",
|
|
83
|
+
"bench:overhead": "node scripts/benchmark-overhead.mjs"
|
|
81
84
|
},
|
|
82
85
|
"dependencies": {
|
|
86
|
+
"@guanmingchiu/sqlparser-ts": "^0.62.0",
|
|
83
87
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
84
88
|
"express": "^5.2.1",
|
|
85
89
|
"js-yaml": "^5.2.3",
|
|
86
90
|
"node-fetch": "^3.3.2",
|
|
91
|
+
"node-sql-parser": "^5.4.0",
|
|
87
92
|
"pgsql-ast-parser": "^12.0.2",
|
|
88
93
|
"postgres": "^3.4.4",
|
|
89
94
|
"zod": "^3.23.8"
|
|
@@ -95,18 +100,9 @@
|
|
|
95
100
|
"supertest": "^7.2.2",
|
|
96
101
|
"tsx": "^4.16.0",
|
|
97
102
|
"typescript": "^5.5.0",
|
|
98
|
-
"vitest": "^2.0.0"
|
|
99
|
-
"javascript-opentimestamps": "^0.4.5"
|
|
103
|
+
"vitest": "^2.0.0"
|
|
100
104
|
},
|
|
101
105
|
"engines": {
|
|
102
106
|
"node": ">=18"
|
|
103
|
-
},
|
|
104
|
-
"peerDependencies": {
|
|
105
|
-
"javascript-opentimestamps": "^0.4.5"
|
|
106
|
-
},
|
|
107
|
-
"peerDependenciesMeta": {
|
|
108
|
-
"javascript-opentimestamps": {
|
|
109
|
-
"optional": true
|
|
110
|
-
}
|
|
111
107
|
}
|
|
112
108
|
}
|