haechi 0.3.2
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/LICENSE +154 -0
- package/README.md +102 -0
- package/SECURITY.md +31 -0
- package/docs/README.md +35 -0
- package/docs/current/api-stability.ko.md +48 -0
- package/docs/current/api-stability.md +48 -0
- package/docs/current/expert-gap-review-ai-llm-mcp-encryption.ko.md +107 -0
- package/docs/current/expert-gap-review-ai-llm-mcp-encryption.md +107 -0
- package/docs/current/global-privacy-compliance-review.ko.md +110 -0
- package/docs/current/global-privacy-compliance-review.md +110 -0
- package/docs/current/initial-plan-ai-llm-mcp-encryption.ko.md +214 -0
- package/docs/current/initial-plan-ai-llm-mcp-encryption.md +214 -0
- package/docs/current/mvp-0.1-implementation-scope.ko.md +79 -0
- package/docs/current/mvp-0.1-implementation-scope.md +79 -0
- package/docs/current/open-source-modular-architecture.ko.md +387 -0
- package/docs/current/open-source-modular-architecture.md +387 -0
- package/docs/current/prd-ai-llm-mcp-encryption.ko.md +260 -0
- package/docs/current/prd-ai-llm-mcp-encryption.md +262 -0
- package/docs/current/privacy-filtering-policy-draft.ko.md +307 -0
- package/docs/current/privacy-filtering-policy-draft.md +307 -0
- package/docs/current/release-0.2-implementation-scope.ko.md +46 -0
- package/docs/current/release-0.2-implementation-scope.md +46 -0
- package/docs/current/release-0.3-implementation-scope.ko.md +86 -0
- package/docs/current/release-0.3-implementation-scope.md +86 -0
- package/docs/current/release-0.3.2-hardening-scope.ko.md +64 -0
- package/docs/current/release-0.3.2-hardening-scope.md +64 -0
- package/docs/current/release-0.4-implementation-scope.ko.md +121 -0
- package/docs/current/release-0.4-implementation-scope.md +121 -0
- package/docs/current/release-process.ko.md +48 -0
- package/docs/current/release-process.md +48 -0
- package/docs/current/risk-register-release-gate.ko.md +154 -0
- package/docs/current/risk-register-release-gate.md +154 -0
- package/docs/current/shared-responsibility.ko.md +38 -0
- package/docs/current/shared-responsibility.md +38 -0
- package/docs/current/threat-model.ko.md +68 -0
- package/docs/current/threat-model.md +68 -0
- package/examples/llm-prompt-filtering/input.json +13 -0
- package/examples/plugins/custom-filter.plugin.json +29 -0
- package/haechi.config.example.json +70 -0
- package/package.json +74 -0
- package/packages/audit/index.mjs +262 -0
- package/packages/cli/bin/haechi.mjs +341 -0
- package/packages/cli/runtime.mjs +287 -0
- package/packages/core/index.mjs +309 -0
- package/packages/crypto/index.mjs +142 -0
- package/packages/filter/index.mjs +189 -0
- package/packages/mcp-stdio/index.mjs +105 -0
- package/packages/plugin/index.mjs +83 -0
- package/packages/policy/index.mjs +165 -0
- package/packages/policy-bundle/index.mjs +91 -0
- package/packages/privacy-profiles/index.mjs +92 -0
- package/packages/protocol-adapters/index.mjs +111 -0
- package/packages/proxy/index.mjs +534 -0
- package/packages/token-vault/index.mjs +262 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# 오픈소스 모듈형 아키텍처 초안
|
|
2
|
+
|
|
3
|
+
- 문서 상태: Draft 0.1
|
|
4
|
+
- 작성일: 2026-06-08
|
|
5
|
+
- 제품명: Haechi
|
|
6
|
+
- 목적: SaaS가 아닌 오픈소스/self-hosted 보안 인프라로서, 암호화·정책·개인정보 필터링 로직을 쉽게 교체할 수 있는 구조 정의
|
|
7
|
+
|
|
8
|
+
## 1. 방향
|
|
9
|
+
|
|
10
|
+
Haechi의 초기 목표는 상용 SaaS가 아니다. 작고, 보안적으로 설명 가능하며, 다른 개발자가 자기 AI/LLM/MCP 애플리케이션에 붙여 볼 수 있는 오픈소스 모듈이다.
|
|
11
|
+
|
|
12
|
+
핵심은 "Haechi가 모든 정답을 제공한다"가 아니라 "Haechi가 안전한 경계와 테스트 기준을 제공하고, 사용자는 그 안에서 자기 구현을 갈아끼운다"다.
|
|
13
|
+
|
|
14
|
+
따라서 초기 설계의 우선순위는 다음이다.
|
|
15
|
+
|
|
16
|
+
1. 동작하는 MCP/LLM 보호 데모
|
|
17
|
+
2. 교체 가능한 provider interface
|
|
18
|
+
3. reference implementation
|
|
19
|
+
4. conformance test와 negative security test
|
|
20
|
+
5. 플러그인 capability 선언과 fail-closed loading
|
|
21
|
+
|
|
22
|
+
### 1.1 적용성 기준
|
|
23
|
+
|
|
24
|
+
보안적으로 좋은 설계라도 적용이 어렵다면 OSS로 확산되기 어렵다. Haechi는 다음 적용성 기준을 제품 요구사항으로 둔다.
|
|
25
|
+
|
|
26
|
+
| 기준 | 목표 |
|
|
27
|
+
|---|---|
|
|
28
|
+
| 5분 local demo | `haechi init` 후 local key, sample policy, dry-run audit까지 실행 |
|
|
29
|
+
| 30분 MCP/LLM PoC | 기존 MCP host 또는 LLM HTTP 호출을 local proxy로 우회 |
|
|
30
|
+
| 1일 custom filter PoC | 사용자가 자체 dictionary/regex/rule을 추가하고 fixture test 실행 |
|
|
31
|
+
| 최소 코드 변경 | proxy mode에서는 app code 변경 없이 base URL/env var 변경으로 시작 |
|
|
32
|
+
| 점진적 강제 | 처음에는 `dry-run`, 이후 `redact`, `tokenize`, `encrypt`, `block` 적용 |
|
|
33
|
+
| 쉬운 교체 | config 또는 dependency injection으로 provider 교체 |
|
|
34
|
+
|
|
35
|
+
적용 경로는 세 단계로 나눈다.
|
|
36
|
+
|
|
37
|
+
1. No-code adoption: local proxy, sidecar, env var, target URL 변경
|
|
38
|
+
2. Low-code adoption: middleware 또는 SDK wrapper 10줄 이내 적용
|
|
39
|
+
3. Custom adoption: `PolicyEngine`, `FilterEngine`, `CryptoProvider`, `AuditSink` 교체
|
|
40
|
+
|
|
41
|
+
## 2. 비목표
|
|
42
|
+
|
|
43
|
+
- hosted SaaS control plane
|
|
44
|
+
- 과금, 구독, tenant admin portal
|
|
45
|
+
- SOC 2/ISO 인증을 전제로 한 영업용 evidence pack
|
|
46
|
+
- KCMVP 또는 FIPS 인증 provider 내장
|
|
47
|
+
- 자체 암호 primitive 개발
|
|
48
|
+
- 모든 LLM/MCP/A2A/gRPC protocol을 0.1에서 production 수준으로 지원
|
|
49
|
+
- 규제 준수 보증 문구 제공
|
|
50
|
+
|
|
51
|
+
## 3. 패키지 구조 제안
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
packages/
|
|
55
|
+
core/ # pipeline, context model, plugin registry, errors
|
|
56
|
+
crypto/ # reference CryptoProvider, envelope format
|
|
57
|
+
keys/ # local KeyProvider, Vault/KMS adapter skeleton
|
|
58
|
+
policy/ # JSON/YAML reference PolicyEngine
|
|
59
|
+
filter/ # PII/secret reference FilterEngine
|
|
60
|
+
token-vault/ # local encrypted TokenVault reference
|
|
61
|
+
audit/ # JSONL AuditSink, safe event schema
|
|
62
|
+
mcp/ # MCP Streamable HTTP proxy, stdio wrapper
|
|
63
|
+
llm/ # OpenAI-compatible HTTP adapter
|
|
64
|
+
grpc/ # protobuf/gRPC adapter skeleton
|
|
65
|
+
a2a/ # A2A adapter skeleton
|
|
66
|
+
cli/ # local demo and fixture runner
|
|
67
|
+
testing/ # conformance fixtures, negative tests
|
|
68
|
+
examples/
|
|
69
|
+
mcp-tool-protection/
|
|
70
|
+
llm-prompt-filtering/
|
|
71
|
+
custom-policy-engine/
|
|
72
|
+
custom-filter-engine/
|
|
73
|
+
custom-audit-sink/
|
|
74
|
+
docs/
|
|
75
|
+
current/
|
|
76
|
+
specs/
|
|
77
|
+
threat-model/
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
초기 공개 범위는 `core`, `crypto`, `policy`, `filter`, `audit`, `mcp`, `llm`, `cli`, `testing`, `examples`만으로 충분하다. `grpc`와 `a2a`는 interface와 skeleton 수준으로 남겨도 된다.
|
|
81
|
+
|
|
82
|
+
## 3.1 적용 모드
|
|
83
|
+
|
|
84
|
+
| Mode | 변경 범위 | 적합한 상황 | 예시 |
|
|
85
|
+
|---|---|---|---|
|
|
86
|
+
| Local proxy | 코드 변경 거의 없음 | LLM HTTP, MCP Streamable HTTP를 빠르게 보호 | base URL을 `http://localhost:1016`로 변경 |
|
|
87
|
+
| SDK wrapper | 작은 코드 변경 | 앱 내부 context를 더 정확히 전달 | `haechi.protectMessage(...)` |
|
|
88
|
+
| Middleware | 웹/API 서버에 삽입 | Express/Fastify/FastAPI 같은 gateway | request/response hook |
|
|
89
|
+
| Sidecar | self-hosted service 옆 배치 | 컨테이너/서버 운영 환경 | app -> sidecar -> provider |
|
|
90
|
+
| Protocol adapter | protocol별 통합 | MCP stdio, gRPC, A2A | adapter가 normalize/denormalize |
|
|
91
|
+
| Custom provider | 특정 로직 교체 | 사내 정책/필터/키 관리 필요 | custom `FilterEngine` |
|
|
92
|
+
|
|
93
|
+
초기 UX는 proxy mode를 최우선으로 둔다. 이유는 사용자가 보안 모듈의 가치를 확인하기 전에 기존 앱을 크게 고치게 만들면 채택이 느려지기 때문이다.
|
|
94
|
+
|
|
95
|
+
최소 설정 예시는 다음과 같다.
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
mode: proxy
|
|
99
|
+
target:
|
|
100
|
+
type: llm-http
|
|
101
|
+
upstream: https://api.openai.example/v1
|
|
102
|
+
policy:
|
|
103
|
+
preset:
|
|
104
|
+
- korean-pii
|
|
105
|
+
- secrets-only
|
|
106
|
+
- llm-redact
|
|
107
|
+
mode: dry-run
|
|
108
|
+
keys:
|
|
109
|
+
provider: local
|
|
110
|
+
keyFile: ./.haechi/dev.keys.json
|
|
111
|
+
audit:
|
|
112
|
+
sink: jsonl
|
|
113
|
+
path: ./.haechi/audit.jsonl
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
초기 명령 흐름은 다음 정도가 적절하다.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
haechi init --preset mcp-basic --profile kr
|
|
120
|
+
haechi proxy --config haechi.yaml --dry-run
|
|
121
|
+
haechi report --audit ./.haechi/audit.jsonl
|
|
122
|
+
haechi test-plugin ./plugins/my-filter
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 4. Core Pipeline
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
ProtocolAdapter
|
|
129
|
+
|
|
|
130
|
+
v
|
|
131
|
+
Core Pipeline
|
|
132
|
+
|
|
|
133
|
+
+-- normalize input
|
|
134
|
+
+-- attach security context
|
|
135
|
+
+-- run FilterEngine.detect
|
|
136
|
+
+-- run PolicyEngine.decide
|
|
137
|
+
+-- transform payload
|
|
138
|
+
| +-- redact
|
|
139
|
+
| +-- mask
|
|
140
|
+
| +-- tokenize
|
|
141
|
+
| +-- encrypt
|
|
142
|
+
| +-- block
|
|
143
|
+
+-- emit AuditSink event
|
|
144
|
+
|
|
|
145
|
+
v
|
|
146
|
+
Protected protocol output
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Pipeline은 protocol별 구현보다 위에 있어야 한다. MCP, LLM HTTP, gRPC, A2A adapter는 모두 같은 `SecurityContext`, `PolicyDecision`, `Detection`, `AuditEvent` 모델을 사용해야 한다.
|
|
150
|
+
|
|
151
|
+
## 5. 교체 가능한 Provider 경계
|
|
152
|
+
|
|
153
|
+
| Provider | 책임 | 기본 구현 | 사용자가 교체하는 이유 |
|
|
154
|
+
|---|---|---|---|
|
|
155
|
+
| `CryptoProvider` | 암호화, 복호화, rewrap, envelope metadata 검증 | XChaCha20-Poly1305 또는 AES-GCM 기반 envelope | 조직 표준 암호 포맷, JWE, HPKE, HSM 연동 |
|
|
156
|
+
| `KeyProvider` | key id 해석, data key/wrapping key 제공, rotation | local software key | Vault, AWS KMS, GCP KMS, Azure Key Vault, HSM |
|
|
157
|
+
| `PolicyEngine` | payload 처리 결정 | JSON/YAML policy | OPA/Rego, CEL, 자체 ABAC/RBAC 정책 |
|
|
158
|
+
| `FilterEngine` | PII/secret 탐지와 변환 후보 생성 | regex/checksum/dictionary | 자체 개인정보 룰, NER, local classifier |
|
|
159
|
+
| `TokenVault` | tokenization 원문 보관, reveal, purge | local encrypted vault | DB, organization vault, zero-retention tokenization |
|
|
160
|
+
| `AuditSink` | 평문 없는 감사 이벤트 기록 | JSON Lines | SIEM, OpenTelemetry-safe exporter, custom log pipeline |
|
|
161
|
+
| `ProtocolAdapter` | protocol input/output 정규화 | MCP/LLM reference adapter | 사내 gateway, agent framework, custom socket |
|
|
162
|
+
| `ClassifierPlugin` | semantic classification | 없음 또는 local-only demo | 도메인별 민감정보 분류기 |
|
|
163
|
+
|
|
164
|
+
## 6. Interface 초안
|
|
165
|
+
|
|
166
|
+
초기 구현은 TypeScript interface를 기준으로 시작하고, Python SDK는 같은 JSON-compatible request/response model을 공유하는 방식이 현실적이다.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
export interface HaechiProvider {
|
|
170
|
+
id: string;
|
|
171
|
+
version: string;
|
|
172
|
+
capabilities: ProviderCapabilities;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface CryptoProvider extends HaechiProvider {
|
|
176
|
+
encrypt(request: EncryptRequest): Promise<EnvelopeCiphertext>;
|
|
177
|
+
decrypt(request: DecryptRequest): Promise<PlaintextResult>;
|
|
178
|
+
rewrap?(request: RewrapRequest): Promise<EnvelopeCiphertext>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface KeyProvider extends HaechiProvider {
|
|
182
|
+
resolveKey(request: KeyResolveRequest): Promise<KeyDescriptor>;
|
|
183
|
+
rotateKey?(request: KeyRotationRequest): Promise<KeyRotationResult>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface PolicyEngine extends HaechiProvider {
|
|
187
|
+
decide(input: PolicyInput): Promise<PolicyDecision>;
|
|
188
|
+
validatePolicy?(bundle: PolicyBundle): Promise<PolicyValidationResult>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface FilterEngine extends HaechiProvider {
|
|
192
|
+
detect(input: FilterInput): Promise<Detection[]>;
|
|
193
|
+
transform(input: TransformInput): Promise<TransformResult>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface TokenVault extends HaechiProvider {
|
|
197
|
+
tokenize(input: TokenizeInput): Promise<TokenizeResult>;
|
|
198
|
+
reveal(input: RevealInput): Promise<RevealResult>;
|
|
199
|
+
purge(input: PurgeInput): Promise<PurgeResult>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface AuditSink extends HaechiProvider {
|
|
203
|
+
record(event: AuditEvent): Promise<void>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface ProtocolAdapter extends HaechiProvider {
|
|
207
|
+
normalize(input: ProtocolInput): Promise<NormalizedMessage>;
|
|
208
|
+
denormalize(output: ProtectedMessage): Promise<ProtocolOutput>;
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 7. Security Context
|
|
213
|
+
|
|
214
|
+
Provider가 받는 context는 protocol별 raw metadata가 아니라 canonical context여야 한다.
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
export interface SecurityContext {
|
|
218
|
+
tenantId?: string;
|
|
219
|
+
userId?: string;
|
|
220
|
+
agentId?: string;
|
|
221
|
+
sessionId?: string;
|
|
222
|
+
taskId?: string;
|
|
223
|
+
contextId?: string;
|
|
224
|
+
modelProvider?: string;
|
|
225
|
+
modelId?: string;
|
|
226
|
+
protocol: "mcp" | "llm-http" | "grpc" | "a2a" | "socket" | "custom";
|
|
227
|
+
operation: string;
|
|
228
|
+
resourceUri?: string;
|
|
229
|
+
toolName?: string;
|
|
230
|
+
region?: string;
|
|
231
|
+
policyVersion: string;
|
|
232
|
+
aad: CanonicalAad;
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
중요한 원칙은 `SecurityContext`가 암호화 AAD, 정책 평가, 감사 이벤트의 공통 기준이라는 점이다. 같은 payload라도 tenant, task, tool, model, policy version이 다르면 다른 보안 판단과 다른 암호문이 나와야 한다.
|
|
237
|
+
|
|
238
|
+
## 8. Plugin Manifest
|
|
239
|
+
|
|
240
|
+
Plugin은 코드만 등록하면 안 된다. 무엇을 할 수 있는지 먼저 선언해야 한다.
|
|
241
|
+
|
|
242
|
+
```yaml
|
|
243
|
+
haechiPlugin:
|
|
244
|
+
id: example-custom-filter
|
|
245
|
+
version: 0.1.0
|
|
246
|
+
kind: filter-engine
|
|
247
|
+
runtime: node
|
|
248
|
+
entrypoint: ./dist/index.js
|
|
249
|
+
compatibility:
|
|
250
|
+
haechiCore: ">=0.1.0 <0.2.0"
|
|
251
|
+
capabilities:
|
|
252
|
+
readsPlaintext: true
|
|
253
|
+
writesPlaintext: false
|
|
254
|
+
networkEgress: false
|
|
255
|
+
fileWrite: false
|
|
256
|
+
auditWrite: false
|
|
257
|
+
externalSecrets: false
|
|
258
|
+
dataHandling:
|
|
259
|
+
storesPayload: false
|
|
260
|
+
retention: none
|
|
261
|
+
logsRawPayload: false
|
|
262
|
+
tests:
|
|
263
|
+
conformance: ./fixtures/conformance.json
|
|
264
|
+
negative: ./fixtures/negative.json
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Manifest에 없는 capability를 plugin이 요구하면 load를 거부한다. 보안상 알 수 없는 plugin은 fail-closed가 기본이다.
|
|
268
|
+
|
|
269
|
+
## 9. 쉽게 갈아끼우는 사용 예
|
|
270
|
+
|
|
271
|
+
사용자는 기본 필터를 그대로 쓰다가 자기 조직의 내부 프로젝트명, 고객 코드, 계약번호를 잡는 custom filter만 추가할 수 있어야 한다.
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
import { createHaechi } from "@haechi/core";
|
|
275
|
+
import { referenceCrypto } from "@haechi/crypto";
|
|
276
|
+
import { localKeyProvider } from "@haechi/keys";
|
|
277
|
+
import { yamlPolicyEngine } from "@haechi/policy";
|
|
278
|
+
import { koreanPiiFilter } from "@haechi/filter";
|
|
279
|
+
import { jsonlAuditSink } from "@haechi/audit";
|
|
280
|
+
import { myInternalCodeFilter } from "./my-filter";
|
|
281
|
+
|
|
282
|
+
export const haechi = createHaechi({
|
|
283
|
+
crypto: referenceCrypto(),
|
|
284
|
+
keys: localKeyProvider({ keyFile: "./dev.keys.json" }),
|
|
285
|
+
policy: yamlPolicyEngine({ policyFile: "./haechi.policy.yaml" }),
|
|
286
|
+
filters: [
|
|
287
|
+
koreanPiiFilter(),
|
|
288
|
+
myInternalCodeFilter()
|
|
289
|
+
],
|
|
290
|
+
audit: jsonlAuditSink({ path: "./audit.jsonl" })
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
다른 사용자는 정책 엔진만 OPA/Rego로 바꾸고 나머지는 reference implementation을 유지할 수 있다.
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
export const haechi = createHaechi({
|
|
298
|
+
crypto: referenceCrypto(),
|
|
299
|
+
keys: localKeyProvider(),
|
|
300
|
+
policy: opaPolicyEngine({ bundlePath: "./policy-bundle" }),
|
|
301
|
+
filters: [koreanPiiFilter()],
|
|
302
|
+
audit: jsonlAuditSink()
|
|
303
|
+
});
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 10. Plugin 보안 검토 항목
|
|
307
|
+
|
|
308
|
+
Plugin architecture는 확장성을 주지만 새로운 공격면도 만든다. 다음 항목은 MVP부터 테스트 기준으로 둔다.
|
|
309
|
+
|
|
310
|
+
| 항목 | 위험 | 기준 |
|
|
311
|
+
|---|---|---|
|
|
312
|
+
| 평문 접근 | filter, crypto, policy plugin이 prompt/tool result를 읽음 | manifest `readsPlaintext` 필수 선언 |
|
|
313
|
+
| 네트워크 송신 | classifier가 원문을 외부 endpoint로 전송 | 기본 금지, opt-in도 audit 필수 |
|
|
314
|
+
| 로그 유출 | plugin debug log에 원문 저장 | raw payload logging 금지 fixture |
|
|
315
|
+
| policy bypass | custom policy가 hard block rule을 완화 | global emergency block 우선순위 고정 |
|
|
316
|
+
| audit 조작 | plugin이 audit event를 누락하거나 변조 | core가 최종 audit event를 직접 생성 |
|
|
317
|
+
| key misuse | custom crypto가 nonce 재사용 또는 AAD 누락 | conformance negative test 통과 필수 |
|
|
318
|
+
| supply chain | 악성 dependency 포함 | SBOM, dependency policy, signed release |
|
|
319
|
+
| version drift | core와 plugin schema 불일치 | compatibility range와 schema validation |
|
|
320
|
+
|
|
321
|
+
## 11. Conformance Test
|
|
322
|
+
|
|
323
|
+
Provider 교체를 쉽게 하려면 테스트가 interface의 일부여야 한다.
|
|
324
|
+
|
|
325
|
+
필수 test category:
|
|
326
|
+
|
|
327
|
+
- `golden`: 정상 입력에서 결정적 결과 구조 확인
|
|
328
|
+
- `tamper`: AAD, ciphertext, policy version 변조 시 실패
|
|
329
|
+
- `cross-context`: 다른 tenant/task/tool/model에서 복호화 실패
|
|
330
|
+
- `replay`: nonce/session/stream sequence 재사용 실패
|
|
331
|
+
- `privacy-leak`: audit/log/metric에 원문 미포함
|
|
332
|
+
- `policy-conflict`: hard block이 allow override보다 우선
|
|
333
|
+
- `capability`: manifest 밖 capability 사용 실패
|
|
334
|
+
- `regional-profile`: EU/US/KR profile별 action 차이 확인
|
|
335
|
+
- `custom-filter`: 사용자 rule 충돌, rollback, fixture 기반 검증
|
|
336
|
+
|
|
337
|
+
## 12. OSS 공개 전략
|
|
338
|
+
|
|
339
|
+
초기 repository는 작게 공개하는 편이 낫다.
|
|
340
|
+
|
|
341
|
+
권장 공개물:
|
|
342
|
+
|
|
343
|
+
- `README.md`: 문제, 데모, 설치, non-compliance disclaimer
|
|
344
|
+
- `SECURITY.md`: 취약점 제보, 지원 버전, 금지 claim
|
|
345
|
+
- `docs/threat-model/`: AI/MCP threat model
|
|
346
|
+
- `docs/specs/`: envelope, policy, filter, audit schema
|
|
347
|
+
- `examples/`: MCP tool-call 보호와 LLM prompt filtering demo
|
|
348
|
+
- `packages/testing/`: plugin conformance test
|
|
349
|
+
- `LICENSE`: Apache-2.0 우선 검토
|
|
350
|
+
|
|
351
|
+
라이선스는 Apache-2.0을 우선 검토한다. 이유는 오픈소스 보안 인프라에서 특허 grant가 명시되어 있어 기업/개발자 채택에 더 유리하기 때문이다. 단순성과 permissive simplicity를 최우선으로 두면 MIT도 가능하다.
|
|
352
|
+
|
|
353
|
+
## 13. 0.1 구현 우선순위
|
|
354
|
+
|
|
355
|
+
| 순서 | 구현 | 이유 |
|
|
356
|
+
|---:|---|---|
|
|
357
|
+
| 1 | `@haechi/core` pipeline과 provider registry | 모든 교체 가능 구조의 중심 |
|
|
358
|
+
| 2 | `PolicyEngine`, `FilterEngine`, `CryptoProvider` interface | 사용자가 가장 바꾸고 싶어 할 지점 |
|
|
359
|
+
| 3 | reference JSON/YAML policy | 이해하기 쉬운 기본 정책 |
|
|
360
|
+
| 4 | Korean PII/secret reference filter | 국내 적용성과 기본 보호 범위를 보여주기 좋음 |
|
|
361
|
+
| 5 | envelope crypto reference | 암호화 솔루션의 핵심 데모 |
|
|
362
|
+
| 6 | MCP Streamable HTTP proxy | AI/MCP 특화 포지션 증명 |
|
|
363
|
+
| 7 | OpenAI-compatible adapter | LLM gateway 적용성 증명 |
|
|
364
|
+
| 8 | JSONL audit sink | 평문 미노출 검증 가능 |
|
|
365
|
+
| 9 | conformance/negative tests | 보안 프로젝트의 신뢰도 확보 |
|
|
366
|
+
| 10 | custom filter/policy examples | "갈아끼우기 쉬움"을 실제로 증명 |
|
|
367
|
+
|
|
368
|
+
## 14. 남은 결정
|
|
369
|
+
|
|
370
|
+
- TypeScript-first로 interface를 고정할지, JSON Schema/IDL을 먼저 둘지
|
|
371
|
+
- reference crypto format을 JWE로 둘지 compact custom envelope로 둘지
|
|
372
|
+
- policy 언어를 자체 YAML로 시작할지 CEL/OPA 호환을 우선할지
|
|
373
|
+
- plugin sandbox를 Node process isolation까지 할지, manifest와 test gate부터 시작할지
|
|
374
|
+
- Python SDK를 0.1에 포함할지, 0.2로 미룰지
|
|
375
|
+
- Apache-2.0과 MIT 중 어떤 라이선스를 선택할지
|
|
376
|
+
|
|
377
|
+
## 15. 결론
|
|
378
|
+
|
|
379
|
+
이 방향은 SaaS보다 오픈소스 확산과 self-hosted 적용에 더 잘 맞는다. 기능을 크게 보이게 만드는 것보다, 작은 core가 실제로 MCP/LLM payload를 보호하고 사용자가 policy/filter/crypto를 바꿔도 같은 보안 테스트를 통과하게 만드는 것이 더 강한 프로젝트 신호다.
|
|
380
|
+
|
|
381
|
+
초기 슬로건은 다음 정도가 적절하다.
|
|
382
|
+
|
|
383
|
+
```text
|
|
384
|
+
AI context protection toolkit for MCP and LLM apps.
|
|
385
|
+
Pluggable crypto, policy, privacy filtering, and audit.
|
|
386
|
+
Self-hosted by default. No SaaS required.
|
|
387
|
+
```
|