@conarium-ai/core 0.2.11 → 0.2.13
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 +149 -1
- package/LICENSE +21 -21
- package/LIMITATIONS.md +36 -2
- package/LIMITATIONS.tr.md +25 -2
- package/SECURITY.md +1 -0
- package/bin/conarium-coverage.mjs +89 -6
- package/bin/conarium-doctor.mjs +62 -0
- package/bin/conarium-verify.mjs +110 -51
- package/dist/anchor.d.ts +11 -0
- package/dist/anchor.d.ts.map +1 -1
- package/dist/anchor.js +27 -0
- package/dist/anchor.js.map +1 -1
- package/dist/audit.d.ts +4 -0
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +136 -33
- package/dist/audit.js.map +1 -1
- package/dist/config.d.ts +28 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +51 -1
- package/dist/config.js.map +1 -1
- package/dist/connectors/custom-sql.d.ts +22 -0
- package/dist/connectors/custom-sql.d.ts.map +1 -0
- package/dist/connectors/custom-sql.js +67 -0
- package/dist/connectors/custom-sql.js.map +1 -0
- package/dist/connectors/index.d.ts +1 -0
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +5 -1
- package/dist/connectors/index.js.map +1 -1
- package/dist/connectors/openapi.d.ts +14 -1
- package/dist/connectors/openapi.d.ts.map +1 -1
- package/dist/connectors/openapi.js +78 -6
- package/dist/connectors/openapi.js.map +1 -1
- package/dist/connectors/postgres.js +8 -8
- package/dist/connectors/supabase_rest.d.ts.map +1 -1
- package/dist/connectors/supabase_rest.js +0 -1
- package/dist/connectors/supabase_rest.js.map +1 -1
- package/dist/console-receipts.d.ts +12 -1
- package/dist/console-receipts.d.ts.map +1 -1
- package/dist/console-receipts.js +14 -2
- package/dist/console-receipts.js.map +1 -1
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +15 -4
- package/dist/console.js.map +1 -1
- package/dist/coverage.d.ts +17 -1
- package/dist/coverage.d.ts.map +1 -1
- package/dist/coverage.js +30 -3
- package/dist/coverage.js.map +1 -1
- package/dist/digit_pii.d.ts.map +1 -1
- package/dist/digit_pii.js +24 -5
- package/dist/digit_pii.js.map +1 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +0 -1
- package/dist/executor.js.map +1 -1
- package/dist/governance.d.ts +2 -0
- package/dist/governance.d.ts.map +1 -1
- package/dist/governance.js +23 -8
- package/dist/governance.js.map +1 -1
- package/dist/http.d.ts +11 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +87 -7
- package/dist/http.js.map +1 -1
- package/dist/iban.d.ts.map +1 -1
- package/dist/iban.js +6 -3
- package/dist/iban.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +5 -0
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +22 -7
- package/dist/keys.js.map +1 -1
- package/dist/mask-text.d.ts +11 -0
- package/dist/mask-text.d.ts.map +1 -0
- package/dist/mask-text.js +42 -0
- package/dist/mask-text.js.map +1 -0
- package/dist/receipt-view.d.ts +13 -0
- package/dist/receipt-view.d.ts.map +1 -1
- package/dist/receipt-view.js +28 -5
- package/dist/receipt-view.js.map +1 -1
- package/dist/search_policy.d.ts.map +1 -1
- package/dist/search_policy.js +8 -4
- package/dist/search_policy.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +111 -20
- package/dist/server.js.map +1 -1
- package/dist/sql-executor.d.ts +14 -0
- package/dist/sql-executor.d.ts.map +1 -0
- package/dist/sql-executor.js +75 -0
- package/dist/sql-executor.js.map +1 -0
- package/dist/sql-gate/mssql.d.ts.map +1 -1
- package/dist/sql-gate/mssql.js +36 -2
- package/dist/sql-gate/mssql.js.map +1 -1
- package/dist/sql-gate/oracle.d.ts.map +1 -1
- package/dist/sql-gate/oracle.js +24 -3
- package/dist/sql-gate/oracle.js.map +1 -1
- package/dist/sql-gate/rules.d.ts +19 -1
- package/dist/sql-gate/rules.d.ts.map +1 -1
- package/dist/sql-gate/rules.js +116 -7
- package/dist/sql-gate/rules.js.map +1 -1
- package/dist/table-unavailable.d.ts +12 -0
- package/dist/table-unavailable.d.ts.map +1 -0
- package/dist/table-unavailable.js +32 -0
- package/dist/table-unavailable.js.map +1 -0
- package/dist/types.d.ts +10 -3
- package/dist/types.d.ts.map +1 -1
- package/docs/API-STABILITY.md +4 -4
- package/docs/ARCHITECTURE.md +42 -42
- package/docs/BENCHMARK.md +20 -0
- package/docs/RECEIPT-SPEC.md +17 -11
- package/docs/benchmarks/concurrency-20260814.json +38 -0
- package/docs/plans/2026-07-02-redteam-harness.md +416 -416
- package/docs/security/NPM-PROVENANCE.md +64 -0
- package/docs/security/THREAT-MODEL.md +18 -0
- package/docs/specs/2026-07-02-redteam-harness-design.md +90 -90
- package/docs/superpowers/TODO-gate1-f4.md +23 -23
- package/docs/superpowers/plans/2026-07-29-conarium-receipt-plan.md +200 -200
- package/docs/superpowers/specs/2026-07-29-conarium-receipt-design.md +202 -202
- package/examples/claude-desktop-config.json +9 -9
- package/examples/cursor-mcp-settings.json +10 -10
- package/examples/custom-sql/README.md +50 -0
- package/examples/custom-sql/conarium.config.json +22 -0
- package/examples/custom-sql/memory-executor.mjs +16 -0
- package/package.json +8 -4
- package/public/app.js +378 -378
- package/public/index.html +160 -160
- package/public/style.css +504 -504
- package/scripts/benchmark-concurrency.mjs +133 -0
- package/scripts/conarium_sabah_brief.mjs +107 -107
- package/scripts/start-mcp-c1.mjs +93 -93
- package/test-vectors/sql-gate/LAST-RUN.json +1 -1
- package/test-vectors/sql-gate/vectors.json +28 -0
- package/dist/openapi_connector.d.ts +0 -6
- package/dist/openapi_connector.d.ts.map +0 -1
- package/dist/openapi_connector.js +0 -145
- package/dist/openapi_connector.js.map +0 -1
- package/docs/audit/2026-08-14-security-scan.md +0 -48
- package/docs/audit/2026-08-14-surface-sync.md +0 -34
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# npm provenance
|
|
2
|
+
|
|
3
|
+
How a bank checks that an `@conarium-ai/core` tarball was built from this
|
|
4
|
+
repository, not from a laptop zip.
|
|
5
|
+
|
|
6
|
+
This is **not** a published release. The workflow
|
|
7
|
+
[`.github/workflows/publish.yml`](../../.github/workflows/publish.yml) is
|
|
8
|
+
dispatch-only. It does not run on push. The first publish is a human decision.
|
|
9
|
+
|
|
10
|
+
## What provenance is
|
|
11
|
+
|
|
12
|
+
When `npm publish --provenance` runs on GitHub Actions with `id-token: write`,
|
|
13
|
+
npm stores a signed attestation: package version ↔ git commit ↔ workflow.
|
|
14
|
+
|
|
15
|
+
## How to verify (after a provenance-backed release exists)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm view @conarium-ai/core@<version> --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Look for attestations / provenance on that version. Then:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx npm-provenance-check @conarium-ai/core@<version>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or, with GitHub CLI, verify the attestation against this repo:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
gh attestation verify --owner dogrucanemek-alt <downloaded.tgz>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If a version has **no** attestation, it was not published through this
|
|
34
|
+
workflow (or was published before the workflow existed). Treat that as
|
|
35
|
+
undeclared origin — not as "verified".
|
|
36
|
+
|
|
37
|
+
## One-time setup before the first publish
|
|
38
|
+
|
|
39
|
+
Auth is **npm Trusted Publishing (OIDC)**, not a stored token. npm hands the
|
|
40
|
+
workflow a short-lived credential in exchange for its GitHub identity, so there
|
|
41
|
+
is no long-lived publish secret in this repository to leak.
|
|
42
|
+
|
|
43
|
+
On npmjs.com, as the package owner:
|
|
44
|
+
|
|
45
|
+
1. `@conarium-ai/core` → **Settings** → **Trusted Publisher**
|
|
46
|
+
2. Publisher: **GitHub Actions**
|
|
47
|
+
3. Repository: `dogrucanemek-alt/conarium`
|
|
48
|
+
4. Workflow file: `publish.yml`
|
|
49
|
+
|
|
50
|
+
Then publish: GitHub → **Actions** → **publish** → *Run workflow* →
|
|
51
|
+
type `publish` in the confirm box. The workflow runs lint, tests and checks
|
|
52
|
+
before it publishes; a red gate stops the release.
|
|
53
|
+
|
|
54
|
+
If npm rejects the OIDC exchange, do **not** fall back to adding an
|
|
55
|
+
`NPM_TOKEN` secret. Publish by hand from a workstation for that release and fix
|
|
56
|
+
the trusted publisher configuration afterwards — provenance is worth less than
|
|
57
|
+
a leaked publish credential costs.
|
|
58
|
+
|
|
59
|
+
## What this does not prove
|
|
60
|
+
|
|
61
|
+
- Not a pentest.
|
|
62
|
+
- Not that the commit is free of bugs.
|
|
63
|
+
- Not that the operator's install matches the tarball (`npm ci` + lockfile
|
|
64
|
+
does that locally).
|
|
@@ -100,6 +100,24 @@ Pending OpenTimestamps is disclosed as `pending`. Bitcoin upgrade is hours later
|
|
|
100
100
|
- A shorter leftover chain still verifies. That is structural, not a bug.
|
|
101
101
|
- Anchor calendars and `blockstream.info` are third parties. Unreachable →
|
|
102
102
|
exit 15 ("could not check"), not exit 0.
|
|
103
|
+
- Two OS processes writing the same audit/receipt sink have no file lock.
|
|
104
|
+
In-process concurrent `log()` is synchronous and keeps the chain (measured:
|
|
105
|
+
50 queries, 0 `prevHash` breaks). Same-millisecond writers across processes
|
|
106
|
+
can fork the chain. Single-process installs are the supported shape.
|
|
107
|
+
|
|
108
|
+
## Out of scope — the operator
|
|
109
|
+
|
|
110
|
+
Conarium's trust boundary is **assistant ↔ gateway**. The operator is inside it.
|
|
111
|
+
|
|
112
|
+
Code that imports this library can call `CustomSqlConnector.runGoverned`, or
|
|
113
|
+
open the database with the same credential. That is the same authority as
|
|
114
|
+
connecting to the database directly. It is not a bypass of a defence that was
|
|
115
|
+
meant to stop the operator.
|
|
116
|
+
|
|
117
|
+
The operator's own code does not appear in the audit log. A bank closes that
|
|
118
|
+
with their code review, not with this gateway.
|
|
119
|
+
|
|
120
|
+
This is the product's scope. It is not a vulnerability.
|
|
103
121
|
|
|
104
122
|
## Out of scope (stated so nobody bills hours here)
|
|
105
123
|
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
# Conarium Red-Team Harness v1 — Tasarım Belgesi
|
|
2
|
-
|
|
3
|
-
- **Tarih:** 2026-07-02 · **Sahip:** Emek Can Doğru + Claude (gate)
|
|
4
|
-
- **Konum:** `nexus/redteam/` (Conarium repo, `@conarium-ai/core`)
|
|
5
|
-
- **Bağlam:** STRATEJI.md Faz 1 — "NEO Conarium'a saldırır, Conarium bloklar" demosu + Faz 2 purple-team döngüsünün tohumu.
|
|
6
|
-
|
|
7
|
-
## 1. Amaç
|
|
8
|
-
NEO'nun red-team kolu, Conarium'un `Governance` motoruna bir **saldırı bataryası** fırlatır; her saldırının **SAVUNULDU** (Conarium bloklamış/maskelemiş) mı yoksa **BYPASS** (geçmiş/PII sızmış) mı olduğunu ölçer. Her BYPASS = Conarium'u sertleştirecek gerçek bir politika deliği. Çıktı hem **demo** (NEO saldırır, Conarium savunur) hem de purple-team döngüsünün girdisi.
|
|
9
|
-
|
|
10
|
-
## 2. Kapsam
|
|
11
|
-
### Dahil (MVP — Yaklaşım ①: doğrudan kütüphane çağrısı)
|
|
12
|
-
İki savunma katmanına saldırı:
|
|
13
|
-
- **Sorgu-zamanı (`guardQuery`)**: yazma-op kaçakçılığı, yetkisiz tablo (JOIN/UNION/subquery ile), çoklu-statement, parse hileleri.
|
|
14
|
-
- **Sonuç-zamanı (`redact`/`maskPII`)**: PII exfiltration — encode/base64, alias, format kırma (PII'yi parçalayıp maskeyi atlatma).
|
|
15
|
-
- Rapor: her saldırı → {DEFENDED | BYPASSED} + severity + detay (JSON + Markdown).
|
|
16
|
-
|
|
17
|
-
### Hariç (sonra)
|
|
18
|
-
- Kara-kutu MCP saldırısı (② yaklaşım) ve canlı-AI prompt-injection (③).
|
|
19
|
-
- Politikayı OTOMATİK düzeltme (bulguyu üretiriz; düzeltme insan onayı — STRATEJI Tier 2).
|
|
20
|
-
|
|
21
|
-
## 3. Mimari
|
|
22
|
-
```
|
|
23
|
-
runRedTeam(governance, policy) →
|
|
24
|
-
1. attacks[] topla (queryTime + resultTime saldırı case'leri)
|
|
25
|
-
2. her case'i çalıştır → AttackResult { defended, detail }
|
|
26
|
-
3. sınıflandır: DEFENDED (blok/maske) vs BYPASSED (geçti/sızdı)
|
|
27
|
-
4. RedTeamReport üret (stats + bulgular)
|
|
28
|
-
```
|
|
29
|
-
`Governance` motorunu doğrudan import eder (aynı repo). Bir test `GovernancePolicy` ile örnek şirket senaryosu kurar.
|
|
30
|
-
|
|
31
|
-
## 4. Modüller (`nexus/redteam/`)
|
|
32
|
-
| Modül | Sorumluluk |
|
|
33
|
-
|---|---|
|
|
34
|
-
| `types.ts` | `AttackCase`, `AttackResult`, `RedTeamReport` |
|
|
35
|
-
| `attacks/queryTime.ts` | Sorgu-zamanı saldırı case'leri (write-smuggle, unauthorized-table, multi-statement) |
|
|
36
|
-
| `attacks/resultTime.ts` | Sonuç-zamanı PII-exfil case'leri (encode/base64, alias, format-break) |
|
|
37
|
-
| `runner.ts` | Case'leri `Governance`'a karşı çalıştır → defended/bypassed sınıfla |
|
|
38
|
-
| `report.ts` | `RedTeamReport` → Markdown + JSON |
|
|
39
|
-
| `index.ts` | `runRedTeam` orkestratör + CLI (`npx tsx redteam/index.ts`) |
|
|
40
|
-
|
|
41
|
-
## 5. Veri Modeli
|
|
42
|
-
```ts
|
|
43
|
-
type AttackCategory = 'write_smuggle' | 'unauthorized_table' | 'multi_statement' | 'pii_exfil';
|
|
44
|
-
type Severity = 'CRITICAL' | 'HIGH' | 'MEDIUM';
|
|
45
|
-
|
|
46
|
-
interface AttackCase {
|
|
47
|
-
id: string;
|
|
48
|
-
category: AttackCategory;
|
|
49
|
-
severity: Severity;
|
|
50
|
-
description: string;
|
|
51
|
-
// Conarium'a saldırıyı uygula; Conarium savundu mu döndür.
|
|
52
|
-
run(gov: Governance): { defended: boolean; detail: string };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface AttackResult { case: AttackCase; defended: boolean; detail: string; }
|
|
56
|
-
|
|
57
|
-
interface RedTeamReport {
|
|
58
|
-
ranAt: string;
|
|
59
|
-
total: number;
|
|
60
|
-
defended: number;
|
|
61
|
-
bypassed: number;
|
|
62
|
-
results: AttackResult[]; // BYPASSED'lar = bulgular
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## 6. Saldırı Case Örnekleri (davranış)
|
|
67
|
-
- **write_smuggle:** `guardQuery("DELETE FROM users")`, `"SELECT 1; DROP TABLE x"`, yorumla gizli write → **DEFENDED beklenir** (PolicyError).
|
|
68
|
-
- **unauthorized_table:** izin-dışı tabloya `JOIN`/`UNION SELECT` → **DEFENDED beklenir**.
|
|
69
|
-
- **pii_exfil (encode):** `redact` katmanına, `encode(email,'base64')` sonucu gibi base64 bir PII değeri ver → maske regex'i yakalamaz → **BYPASSED beklenir** (bilinen gerçek delik; harness'in görevi bunu DOĞRU tespit etmek).
|
|
70
|
-
|
|
71
|
-
## 7. Sınıflandırma Mantığı
|
|
72
|
-
- Sorgu-zamanı: `guardQuery` **PolicyError fırlattıysa** → DEFENDED. Fırlatmadıysa (yetkisiz erişim/write geçtiyse) → BYPASSED.
|
|
73
|
-
- Sonuç-zamanı: sahte sonuç satırı `redact`'ten geçir; PII string'i çıktıda **`[MASKED_PII]` değilse** → BYPASSED (sızıntı).
|
|
74
|
-
|
|
75
|
-
## 8. Test Stratejisi (TDD)
|
|
76
|
-
- Her saldırı case'i için birim test: bilinen-savunulan case DEFENDED döner; encode-base64 case BYPASSED döner (harness'in bypass'ı DOĞRU yakaladığını kanıtlar — Conarium'u değil, harness'i test eder).
|
|
77
|
-
- `runner` testi: karışık case seti → doğru defended/bypassed sayısı.
|
|
78
|
-
- `report` testi: bulgu içeren rapor Markdown'da BYPASSED'ları listeler.
|
|
79
|
-
|
|
80
|
-
## 9. Başarı Kriteri (MVP "bitti")
|
|
81
|
-
Gerçek `Governance` + örnek policy ile `runRedTeam` çalışınca:
|
|
82
|
-
1. En az write-smuggle **DEFENDED**, encode-base64 PII-exfil **BYPASSED** doğru sınıflanır.
|
|
83
|
-
2. Markdown + JSON rapor üretilir (Conarium'un savunma karnesi).
|
|
84
|
-
3. Testler geçer.
|
|
85
|
-
4. Çıktı, Faz 1 demosunun ham materyali olur ("NEO N saldırdı, Conarium X savundu, Y bypass — işte sertleştirilecekler").
|
|
86
|
-
|
|
87
|
-
## 10. Bağımlılık
|
|
88
|
-
- `@conarium-ai/core` `Governance` sınıfı (aynı repo, `src/governance.ts`).
|
|
89
|
-
- Test runner: vitest (yoksa eklenir).
|
|
90
|
-
- Ek dış bağımlılık yok.
|
|
1
|
+
# Conarium Red-Team Harness v1 — Tasarım Belgesi
|
|
2
|
+
|
|
3
|
+
- **Tarih:** 2026-07-02 · **Sahip:** Emek Can Doğru + Claude (gate)
|
|
4
|
+
- **Konum:** `nexus/redteam/` (Conarium repo, `@conarium-ai/core`)
|
|
5
|
+
- **Bağlam:** STRATEJI.md Faz 1 — "NEO Conarium'a saldırır, Conarium bloklar" demosu + Faz 2 purple-team döngüsünün tohumu.
|
|
6
|
+
|
|
7
|
+
## 1. Amaç
|
|
8
|
+
NEO'nun red-team kolu, Conarium'un `Governance` motoruna bir **saldırı bataryası** fırlatır; her saldırının **SAVUNULDU** (Conarium bloklamış/maskelemiş) mı yoksa **BYPASS** (geçmiş/PII sızmış) mı olduğunu ölçer. Her BYPASS = Conarium'u sertleştirecek gerçek bir politika deliği. Çıktı hem **demo** (NEO saldırır, Conarium savunur) hem de purple-team döngüsünün girdisi.
|
|
9
|
+
|
|
10
|
+
## 2. Kapsam
|
|
11
|
+
### Dahil (MVP — Yaklaşım ①: doğrudan kütüphane çağrısı)
|
|
12
|
+
İki savunma katmanına saldırı:
|
|
13
|
+
- **Sorgu-zamanı (`guardQuery`)**: yazma-op kaçakçılığı, yetkisiz tablo (JOIN/UNION/subquery ile), çoklu-statement, parse hileleri.
|
|
14
|
+
- **Sonuç-zamanı (`redact`/`maskPII`)**: PII exfiltration — encode/base64, alias, format kırma (PII'yi parçalayıp maskeyi atlatma).
|
|
15
|
+
- Rapor: her saldırı → {DEFENDED | BYPASSED} + severity + detay (JSON + Markdown).
|
|
16
|
+
|
|
17
|
+
### Hariç (sonra)
|
|
18
|
+
- Kara-kutu MCP saldırısı (② yaklaşım) ve canlı-AI prompt-injection (③).
|
|
19
|
+
- Politikayı OTOMATİK düzeltme (bulguyu üretiriz; düzeltme insan onayı — STRATEJI Tier 2).
|
|
20
|
+
|
|
21
|
+
## 3. Mimari
|
|
22
|
+
```
|
|
23
|
+
runRedTeam(governance, policy) →
|
|
24
|
+
1. attacks[] topla (queryTime + resultTime saldırı case'leri)
|
|
25
|
+
2. her case'i çalıştır → AttackResult { defended, detail }
|
|
26
|
+
3. sınıflandır: DEFENDED (blok/maske) vs BYPASSED (geçti/sızdı)
|
|
27
|
+
4. RedTeamReport üret (stats + bulgular)
|
|
28
|
+
```
|
|
29
|
+
`Governance` motorunu doğrudan import eder (aynı repo). Bir test `GovernancePolicy` ile örnek şirket senaryosu kurar.
|
|
30
|
+
|
|
31
|
+
## 4. Modüller (`nexus/redteam/`)
|
|
32
|
+
| Modül | Sorumluluk |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `types.ts` | `AttackCase`, `AttackResult`, `RedTeamReport` |
|
|
35
|
+
| `attacks/queryTime.ts` | Sorgu-zamanı saldırı case'leri (write-smuggle, unauthorized-table, multi-statement) |
|
|
36
|
+
| `attacks/resultTime.ts` | Sonuç-zamanı PII-exfil case'leri (encode/base64, alias, format-break) |
|
|
37
|
+
| `runner.ts` | Case'leri `Governance`'a karşı çalıştır → defended/bypassed sınıfla |
|
|
38
|
+
| `report.ts` | `RedTeamReport` → Markdown + JSON |
|
|
39
|
+
| `index.ts` | `runRedTeam` orkestratör + CLI (`npx tsx redteam/index.ts`) |
|
|
40
|
+
|
|
41
|
+
## 5. Veri Modeli
|
|
42
|
+
```ts
|
|
43
|
+
type AttackCategory = 'write_smuggle' | 'unauthorized_table' | 'multi_statement' | 'pii_exfil';
|
|
44
|
+
type Severity = 'CRITICAL' | 'HIGH' | 'MEDIUM';
|
|
45
|
+
|
|
46
|
+
interface AttackCase {
|
|
47
|
+
id: string;
|
|
48
|
+
category: AttackCategory;
|
|
49
|
+
severity: Severity;
|
|
50
|
+
description: string;
|
|
51
|
+
// Conarium'a saldırıyı uygula; Conarium savundu mu döndür.
|
|
52
|
+
run(gov: Governance): { defended: boolean; detail: string };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface AttackResult { case: AttackCase; defended: boolean; detail: string; }
|
|
56
|
+
|
|
57
|
+
interface RedTeamReport {
|
|
58
|
+
ranAt: string;
|
|
59
|
+
total: number;
|
|
60
|
+
defended: number;
|
|
61
|
+
bypassed: number;
|
|
62
|
+
results: AttackResult[]; // BYPASSED'lar = bulgular
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 6. Saldırı Case Örnekleri (davranış)
|
|
67
|
+
- **write_smuggle:** `guardQuery("DELETE FROM users")`, `"SELECT 1; DROP TABLE x"`, yorumla gizli write → **DEFENDED beklenir** (PolicyError).
|
|
68
|
+
- **unauthorized_table:** izin-dışı tabloya `JOIN`/`UNION SELECT` → **DEFENDED beklenir**.
|
|
69
|
+
- **pii_exfil (encode):** `redact` katmanına, `encode(email,'base64')` sonucu gibi base64 bir PII değeri ver → maske regex'i yakalamaz → **BYPASSED beklenir** (bilinen gerçek delik; harness'in görevi bunu DOĞRU tespit etmek).
|
|
70
|
+
|
|
71
|
+
## 7. Sınıflandırma Mantığı
|
|
72
|
+
- Sorgu-zamanı: `guardQuery` **PolicyError fırlattıysa** → DEFENDED. Fırlatmadıysa (yetkisiz erişim/write geçtiyse) → BYPASSED.
|
|
73
|
+
- Sonuç-zamanı: sahte sonuç satırı `redact`'ten geçir; PII string'i çıktıda **`[MASKED_PII]` değilse** → BYPASSED (sızıntı).
|
|
74
|
+
|
|
75
|
+
## 8. Test Stratejisi (TDD)
|
|
76
|
+
- Her saldırı case'i için birim test: bilinen-savunulan case DEFENDED döner; encode-base64 case BYPASSED döner (harness'in bypass'ı DOĞRU yakaladığını kanıtlar — Conarium'u değil, harness'i test eder).
|
|
77
|
+
- `runner` testi: karışık case seti → doğru defended/bypassed sayısı.
|
|
78
|
+
- `report` testi: bulgu içeren rapor Markdown'da BYPASSED'ları listeler.
|
|
79
|
+
|
|
80
|
+
## 9. Başarı Kriteri (MVP "bitti")
|
|
81
|
+
Gerçek `Governance` + örnek policy ile `runRedTeam` çalışınca:
|
|
82
|
+
1. En az write-smuggle **DEFENDED**, encode-base64 PII-exfil **BYPASSED** doğru sınıflanır.
|
|
83
|
+
2. Markdown + JSON rapor üretilir (Conarium'un savunma karnesi).
|
|
84
|
+
3. Testler geçer.
|
|
85
|
+
4. Çıktı, Faz 1 demosunun ham materyali olur ("NEO N saldırdı, Conarium X savundu, Y bypass — işte sertleştirilecekler").
|
|
86
|
+
|
|
87
|
+
## 10. Bağımlılık
|
|
88
|
+
- `@conarium-ai/core` `Governance` sınıfı (aynı repo, `src/governance.ts`).
|
|
89
|
+
- Test runner: vitest (yoksa eklenir).
|
|
90
|
+
- Ek dış bağımlılık yok.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# Receipt v0.1 — GATE 1 deferred work
|
|
2
|
-
|
|
3
|
-
## F4 — gerçek metin (Claude GATE 1)
|
|
4
|
-
|
|
5
|
-
**Status:** done via **F5** (2026-07-29, push-öncesi) · **Source:** Claude GATE 1
|
|
6
|
-
|
|
7
|
-
**F4 / F5 gövdesi (patron onayıyla uygulanan metin):**
|
|
8
|
-
|
|
9
|
-
> `validateChain`'e bitişiklik kuralı (`sig` taşıyan ilk satırdan sonra her
|
|
10
|
-
> satırda `sig` zorunlu; yabancı `keyId` kabul, yokluk red) + çoklu `keyId`
|
|
11
|
-
> trust store + bu senaryonun testi.
|
|
12
|
-
|
|
13
|
-
### Uygulama (F5)
|
|
14
|
-
|
|
15
|
-
| Kural | Davranış |
|
|
16
|
-
|---|---|
|
|
17
|
-
| Bitişiklik | İlk `sig`'li satırdan sonra `sig` yokluğu → corrupt |
|
|
18
|
-
| Yabancı `keyId` | Trust store'da varsa ve crypto geçerse kabul |
|
|
19
|
-
| Trust store | Mevcut signing pubkey + `CONARIUM_AUDIT_TRUST_PUBKEYS` (`,` / `;`) |
|
|
20
|
-
| Bilinmeyen `keyId` | Trust store doluyken fail-closed |
|
|
21
|
-
| Legacy önek | İlk `sig`'den önceki imzasız satırlar hâlâ kabul |
|
|
22
|
-
|
|
23
|
-
Testler: `src/audit.receipt-gate.test.ts`.
|
|
1
|
+
# Receipt v0.1 — GATE 1 deferred work
|
|
2
|
+
|
|
3
|
+
## F4 — gerçek metin (Claude GATE 1)
|
|
4
|
+
|
|
5
|
+
**Status:** done via **F5** (2026-07-29, push-öncesi) · **Source:** Claude GATE 1
|
|
6
|
+
|
|
7
|
+
**F4 / F5 gövdesi (patron onayıyla uygulanan metin):**
|
|
8
|
+
|
|
9
|
+
> `validateChain`'e bitişiklik kuralı (`sig` taşıyan ilk satırdan sonra her
|
|
10
|
+
> satırda `sig` zorunlu; yabancı `keyId` kabul, yokluk red) + çoklu `keyId`
|
|
11
|
+
> trust store + bu senaryonun testi.
|
|
12
|
+
|
|
13
|
+
### Uygulama (F5)
|
|
14
|
+
|
|
15
|
+
| Kural | Davranış |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Bitişiklik | İlk `sig`'li satırdan sonra `sig` yokluğu → corrupt |
|
|
18
|
+
| Yabancı `keyId` | Trust store'da varsa ve crypto geçerse kabul |
|
|
19
|
+
| Trust store | Mevcut signing pubkey + `CONARIUM_AUDIT_TRUST_PUBKEYS` (`,` / `;`) |
|
|
20
|
+
| Bilinmeyen `keyId` | Trust store doluyken fail-closed |
|
|
21
|
+
| Legacy önek | İlk `sig`'den önceki imzasız satırlar hâlâ kabul |
|
|
22
|
+
|
|
23
|
+
Testler: `src/audit.receipt-gate.test.ts`.
|