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,307 @@
|
|
|
1
|
+
# Privacy Filtering Policy Draft
|
|
2
|
+
|
|
3
|
+
- Status: Draft 0.1
|
|
4
|
+
- Date: 2026-06-08
|
|
5
|
+
- Related product: Haechi
|
|
6
|
+
|
|
7
|
+
## 1. Purpose
|
|
8
|
+
|
|
9
|
+
This document defines a draft policy for detecting and handling personal information and high-risk sensitive data before it is passed to models, tools, agents, logs, traces, and replay artifacts in AI/LLM/MCP environments.
|
|
10
|
+
|
|
11
|
+
Privacy filtering is not a substitute for encryption. Filtering determines whether data is exposed in plaintext; encryption protects data at rest, in transit, and across authorization boundaries. Haechi applies both mechanisms together.
|
|
12
|
+
|
|
13
|
+
## 2. Filtering Points
|
|
14
|
+
|
|
15
|
+
| Point | Description | Default Policy |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| Pre-model | Filter prompts/messages before calling an LLM provider | Must |
|
|
18
|
+
| Post-model | Filter LLM responses before delivering them to users, agents, or tools | Must |
|
|
19
|
+
| MCP tool input | Filter MCP tools/call arguments | Must |
|
|
20
|
+
| MCP tool output | Filter tool results and resource content | Must |
|
|
21
|
+
| RAG input | Filter retrieval queries, snippets, and source metadata | Should |
|
|
22
|
+
| A2A message | Filter agent messages, tasks, and artifacts | Should |
|
|
23
|
+
| Observability | Filter logs, traces, replays, and metric labels | Must |
|
|
24
|
+
|
|
25
|
+
## 3. Default Detection Catalog
|
|
26
|
+
|
|
27
|
+
| Category | Examples | Default Action |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| Unique identifiers | Korean RRN, alien registration number, passport number, driver's license number | block or tokenize |
|
|
30
|
+
| Sensitive data | Health information, biometric data, genetic data, criminal records, political/union/religious information | block or human-review |
|
|
31
|
+
| Contact information | Mobile phone number, telephone number, email, address | mask or tokenize |
|
|
32
|
+
| Financial information | Bank account number, card number, card expiry date, CVC-like values | tokenize or block |
|
|
33
|
+
| Credentials | Passwords, access tokens, refresh tokens, API keys, private keys | block |
|
|
34
|
+
| Customer data | Customer ID, contract number, order number, internal identifiers | tokenize or encrypt |
|
|
35
|
+
| AI-specific sensitive data | Secrets in prompts, personal information in tool outputs, personal information in RAG snippets | redact, tokenize, or encrypt |
|
|
36
|
+
|
|
37
|
+
## 4. Global Regulatory Profiles
|
|
38
|
+
|
|
39
|
+
Regional default profiles alter the detection catalog, default actions, transfer restrictions, audit fields, and retention policies. This table is a starting point for product policy design and does not substitute for legal counsel.
|
|
40
|
+
|
|
41
|
+
| Profile | Key Standards | Default Enhancements |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| KR-PIPA | Personal information, unique identifiers, sensitive information, security measures | Unique identifier block/tokenize, encryption key management, access logging |
|
|
44
|
+
| EU-GDPR | personal data, special categories, pseudonymisation, data minimisation, international transfer | Special category default block/human-review, SCC/adequacy evidence, DPIA evidence |
|
|
45
|
+
| UK-GDPR | UK GDPR, IDTA/Addendum, special category data | UK transfer mechanism evidence, enhanced special category handling |
|
|
46
|
+
| US-CCPA-CPRA | personal information, sensitive personal information, limit use/disclosure | SPI limit-use flag, consumer request evidence |
|
|
47
|
+
| US-HIPAA | PHI, covered entity/business associate, de-identification | PHI default block/tokenize, Safe Harbor style identifier catalog, BAA evidence |
|
|
48
|
+
| PCI-DSS | cardholder data, sensitive authentication data | PAN tokenize/mask, CVC block, prohibition on logging payment data |
|
|
49
|
+
| JP-APPI | personal information, special care-required personal information, anonymized/pseudonymized information | Special care-required information human-review, cross-border consent/evidence |
|
|
50
|
+
| SG-PDPA | consent, purpose limitation, protection, retention, transfer limitation | Purpose binding, transfer limitation evidence |
|
|
51
|
+
| CA-PIPEDA | consent, limiting collection/use/disclosure, safeguards, cross-border handling | Consent/purpose evidence, safeguard audit |
|
|
52
|
+
| BR-LGPD | personal data, sensitive personal data, international transfer | Enhanced sensitive data handling, ANPD transfer mechanism evidence |
|
|
53
|
+
|
|
54
|
+
## 5. Global Policy Decision Context
|
|
55
|
+
|
|
56
|
+
| Context | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| data_subject_region | Inferred or declared region of the data subject |
|
|
59
|
+
| controller_region | Region of the customer/controller |
|
|
60
|
+
| processor_region | Region where Haechi/processor processes data |
|
|
61
|
+
| model_provider_region | Region where the LLM provider processes data |
|
|
62
|
+
| transfer_mechanism | SCC, IDTA, adequacy, BCR, consent, local-only, etc. |
|
|
63
|
+
| sector_profile | healthcare, payment, finance, education, public sector, etc. |
|
|
64
|
+
| lawful_basis_or_purpose | Customer-defined value expressing the processing purpose or legal basis |
|
|
65
|
+
| residency_policy | local-only, region-locked, allowed-regions |
|
|
66
|
+
| retention_policy | Retention policy for audit and token vault |
|
|
67
|
+
|
|
68
|
+
## 6. Detection Methods
|
|
69
|
+
|
|
70
|
+
| Method | Applies To | Requirements |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| Deterministic rule | Korean RRN, card number, email, phone number, API key | Rule IDs and versions must be managed. |
|
|
73
|
+
| Checksum validation | Korean RRN candidates, card number candidates | Candidates that fail validation receive a lower confidence score. |
|
|
74
|
+
| Dictionary | Organization names, internal system names, prohibited terms | Per-tenant dictionaries must be supported. |
|
|
75
|
+
| NER/classifier | Names, addresses, medical/health context, sensitive inference | Local-first by default; external transmission requires separate consent or policy. |
|
|
76
|
+
| Custom entity rule | Customer-specific identifiers, contract numbers, ticket numbers | Schema and action are defined in policy. |
|
|
77
|
+
|
|
78
|
+
## 7. Custom Filtering
|
|
79
|
+
|
|
80
|
+
Default regulatory profiles cannot have full knowledge of a customer's internal data. Haechi must provide per-tenant custom filters as a first-class feature.
|
|
81
|
+
|
|
82
|
+
### 7.1 Custom Detection Targets
|
|
83
|
+
|
|
84
|
+
| Target | Examples |
|
|
85
|
+
|---|---|
|
|
86
|
+
| Internal identifiers | Customer ID, employee ID, membership ID, contract number, order number, ticket number |
|
|
87
|
+
| Product/project confidential data | Code names, product launch names, internal roadmap keywords |
|
|
88
|
+
| Internal system information | internal hostname, repository name, table name, service name |
|
|
89
|
+
| Industry-specific data | Medical chart ID, insurance policy number, invoice number, account alias |
|
|
90
|
+
| AI-specific data | prompt template secret, tool name, private skill name, vector collection name |
|
|
91
|
+
| Security information | internal API key prefix, service account, private endpoint, secret naming pattern |
|
|
92
|
+
|
|
93
|
+
### 7.2 Custom Filter DSL Requirements
|
|
94
|
+
|
|
95
|
+
| Feature | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| regex | Regex-based detection |
|
|
98
|
+
| checksum | Customer-defined checksum or validator function |
|
|
99
|
+
| dictionary | Per-tenant word/phrase dictionary |
|
|
100
|
+
| allowlist | False positive exception handling |
|
|
101
|
+
| denylist | Immediate block targets |
|
|
102
|
+
| path scope | Scope specification by JSONPath, protobuf field path, MCP method, or A2A part type |
|
|
103
|
+
| context condition | Conditions on tenant, app, environment, model provider, region, or purpose |
|
|
104
|
+
| action override | Apply a stricter action than the default profile action |
|
|
105
|
+
| confidence override | Per-rule confidence calculation or fixed confidence value |
|
|
106
|
+
| test fixture | Positive/negative samples with expected actions |
|
|
107
|
+
|
|
108
|
+
### 7.3 Rule Lifecycle
|
|
109
|
+
|
|
110
|
+
| Stage | Requirements |
|
|
111
|
+
|---|---|
|
|
112
|
+
| draft | Rule authors must be able to create drafts without affecting production traffic. |
|
|
113
|
+
| validate | Must check schema, regex safety, catastrophic backtracking, and action conflicts. |
|
|
114
|
+
| test | False positive/negative rates must be measured using fixtures and shadow traffic. |
|
|
115
|
+
| approve | High-risk actions — e.g., block, external classifier, region override — require an approval workflow. |
|
|
116
|
+
| publish | Versioned rollout and tenant/app/environment scope are required. |
|
|
117
|
+
| monitor | Hit rate, action rate, and override rate must be observable. |
|
|
118
|
+
| rollback | Must be able to immediately revert to a previous rule version. |
|
|
119
|
+
|
|
120
|
+
### 7.4 Priority
|
|
121
|
+
|
|
122
|
+
Stronger protection takes precedence over weaker protection.
|
|
123
|
+
|
|
124
|
+
1. Emergency global block rule
|
|
125
|
+
2. Legal/regional profile mandatory rule
|
|
126
|
+
3. Sector profile mandatory rule
|
|
127
|
+
4. Tenant custom rule
|
|
128
|
+
5. Application custom rule
|
|
129
|
+
6. Allowlist exception
|
|
130
|
+
7. Default profile rule
|
|
131
|
+
|
|
132
|
+
An allowlist must not be able to bypass hard-block entities such as unique identifiers, PHI, card security codes, and secrets.
|
|
133
|
+
|
|
134
|
+
### 7.5 Custom Rule Examples
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
customRules:
|
|
138
|
+
- id: tenant-contract-id
|
|
139
|
+
version: 3
|
|
140
|
+
owner: privacy-team
|
|
141
|
+
match:
|
|
142
|
+
regex: "\\bCTR-[0-9]{4}-[A-Z0-9]{8}\\b"
|
|
143
|
+
entityType: TENANT_CONTRACT_ID
|
|
144
|
+
scope:
|
|
145
|
+
sources:
|
|
146
|
+
- pre_model
|
|
147
|
+
- mcp_tool_input
|
|
148
|
+
- a2a_artifact
|
|
149
|
+
action: tokenize
|
|
150
|
+
tests:
|
|
151
|
+
positive:
|
|
152
|
+
- input: "Contract number is CTR-2026-AB12CD34."
|
|
153
|
+
expectedEntity: TENANT_CONTRACT_ID
|
|
154
|
+
expectedAction: tokenize
|
|
155
|
+
negative:
|
|
156
|
+
- input: "CTR-ABCD is a product code."
|
|
157
|
+
expectedEntity: null
|
|
158
|
+
|
|
159
|
+
- id: internal-project-codename
|
|
160
|
+
version: 1
|
|
161
|
+
match:
|
|
162
|
+
dictionaryRef: dict://tenant-a/project-codenames
|
|
163
|
+
caseSensitive: false
|
|
164
|
+
action: block
|
|
165
|
+
appliesTo:
|
|
166
|
+
modelProviderRegionNotIn:
|
|
167
|
+
- local
|
|
168
|
+
- private-cloud
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 8. Processing Actions
|
|
172
|
+
|
|
173
|
+
| Action | Meaning |
|
|
174
|
+
|---|---|
|
|
175
|
+
| allow | Permit the detected result. An audit event is still recorded. |
|
|
176
|
+
| mask | Retain only some characters and mask the rest. |
|
|
177
|
+
| redact | Remove the value and replace it with a placeholder. |
|
|
178
|
+
| tokenize | Replace with a recoverable token. Recovery is performed after authorization evaluation. |
|
|
179
|
+
| encrypt | Replace with an envelope ciphertext. |
|
|
180
|
+
| block | Block the request, response, tool-call, or artifact delivery. |
|
|
181
|
+
| human-review | Send to an approval workflow. Do not forward automatically. |
|
|
182
|
+
| region-deny | Block due to a regional/transfer policy violation. |
|
|
183
|
+
| local-only | Allow local processing only; no calls to external providers. |
|
|
184
|
+
|
|
185
|
+
## 9. Policy Examples
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
profiles:
|
|
189
|
+
active:
|
|
190
|
+
- KR-PIPA
|
|
191
|
+
- EU-GDPR
|
|
192
|
+
- US-CCPA-CPRA
|
|
193
|
+
|
|
194
|
+
rules:
|
|
195
|
+
- id: kr-unique-id-default
|
|
196
|
+
match:
|
|
197
|
+
entityTypes:
|
|
198
|
+
- KR_RRN
|
|
199
|
+
- KR_ALIEN_REG_NO
|
|
200
|
+
- PASSPORT_NO
|
|
201
|
+
- DRIVER_LICENSE_NO
|
|
202
|
+
action: block
|
|
203
|
+
appliesTo:
|
|
204
|
+
- pre_model
|
|
205
|
+
- mcp_tool_input
|
|
206
|
+
- observability
|
|
207
|
+
|
|
208
|
+
- id: contact-info-tokenize
|
|
209
|
+
match:
|
|
210
|
+
entityTypes:
|
|
211
|
+
- EMAIL
|
|
212
|
+
- PHONE
|
|
213
|
+
- ADDRESS
|
|
214
|
+
action: tokenize
|
|
215
|
+
reveal:
|
|
216
|
+
allowedPurposes:
|
|
217
|
+
- customer_support
|
|
218
|
+
requireAudit: true
|
|
219
|
+
|
|
220
|
+
- id: tool-output-redact
|
|
221
|
+
match:
|
|
222
|
+
source: mcp_tool_output
|
|
223
|
+
minConfidence: 0.65
|
|
224
|
+
action: redact
|
|
225
|
+
|
|
226
|
+
- id: eu-special-category-transfer-guard
|
|
227
|
+
match:
|
|
228
|
+
profiles:
|
|
229
|
+
- EU-GDPR
|
|
230
|
+
entityTypes:
|
|
231
|
+
- HEALTH_DATA
|
|
232
|
+
- BIOMETRIC_ID
|
|
233
|
+
- POLITICAL_OPINION
|
|
234
|
+
- UNION_MEMBERSHIP
|
|
235
|
+
destination:
|
|
236
|
+
modelProviderRegionNotIn:
|
|
237
|
+
- EU
|
|
238
|
+
- EEA
|
|
239
|
+
action: region-deny
|
|
240
|
+
require:
|
|
241
|
+
transferMechanism:
|
|
242
|
+
- adequacy
|
|
243
|
+
- SCC
|
|
244
|
+
- BCR
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 10. Audit Events
|
|
248
|
+
|
|
249
|
+
Audit events must not contain the original plaintext values.
|
|
250
|
+
|
|
251
|
+
| Field | Description |
|
|
252
|
+
|---|---|
|
|
253
|
+
| decision_id | Policy decision ID |
|
|
254
|
+
| entity_type | Detected entity type |
|
|
255
|
+
| rule_id | Rule that was applied |
|
|
256
|
+
| confidence | Detection confidence |
|
|
257
|
+
| action | Processing action applied |
|
|
258
|
+
| source | pre_model, mcp_tool_input, etc. |
|
|
259
|
+
| tenant_id_hash | Hash of the tenant identifier |
|
|
260
|
+
| agent_id_hash | Hash of the agent identifier |
|
|
261
|
+
| request_id | Correlation ID |
|
|
262
|
+
| profile | Regional/sector profile applied |
|
|
263
|
+
| transfer_mechanism | Transfer mechanism applied |
|
|
264
|
+
| residency_decision | Residency policy decision |
|
|
265
|
+
| custom_rule_id | Rule ID if a custom rule was applied |
|
|
266
|
+
| custom_rule_version | Custom rule version |
|
|
267
|
+
|
|
268
|
+
## 11. Test Requirements
|
|
269
|
+
|
|
270
|
+
- Maintain Korean personal information fixtures.
|
|
271
|
+
- Maintain fixtures for EU special categories, US sensitive personal information, HIPAA PHI, PCI card data, and Japan/Singapore/Brazil/Canada data.
|
|
272
|
+
- Korean RRN, alien registration number, and card number fixtures must include both checksum-positive and checksum-negative cases.
|
|
273
|
+
- Positive and negative fixtures are mandatory for each custom rule.
|
|
274
|
+
- Check for regex catastrophic backtracking and excessive CPU/memory usage.
|
|
275
|
+
- Test that allowlists cannot bypass hard-block entities.
|
|
276
|
+
- Maintain fixtures per source: prompt, MCP tool input/output, resource, artifact, and log line.
|
|
277
|
+
- Measure false positives and false negatives separately.
|
|
278
|
+
- Perform snapshot tests to verify that no original plaintext remains in pre- and post-filtering results.
|
|
279
|
+
- When using an external classifier, separately verify that personal information is not transmitted in the classifier request payload.
|
|
280
|
+
- Perform negative tests for region-deny, local-only, allowed-regions, and missing transfer-mechanism scenarios.
|
|
281
|
+
|
|
282
|
+
## 12. Open Questions
|
|
283
|
+
|
|
284
|
+
- Decide whether high-risk identifiers such as Korean RRNs should be blocked in all environments, or whether tokenization should be permitted in air-gapped or customer-managed-key environments.
|
|
285
|
+
- Decide whether name/address detection should rely primarily on deterministic rules or also include NER classifiers.
|
|
286
|
+
- Decide whether the privacy filtering confidence threshold should be a global default or configurable per tenant.
|
|
287
|
+
- Decide whether filtering results should be described to the LLM via placeholders or removed entirely.
|
|
288
|
+
- Decide whether GDPR/UK GDPR transfer mechanisms should be hard-enforced by the product or left to customer-provided evidence validation.
|
|
289
|
+
- Decide whether HIPAA/PCI sector profiles should be included in the MVP.
|
|
290
|
+
- Decide whether the custom filter DSL should be maintained as a proprietary YAML schema or adopt a limited subset of an existing expression language such as CEL, OPA, or Rego.
|
|
291
|
+
- Decide whether customer-provided dictionaries should be encrypted with a product-managed KMS or only with customer-managed keys.
|
|
292
|
+
|
|
293
|
+
## 13. References
|
|
294
|
+
|
|
295
|
+
- Korea Personal Information Safety Measures Standards: https://law.go.kr/LSW/admRulInfoP.do?admRulSeq=2100000192069&chrClsCd=010201
|
|
296
|
+
- Korea Personal Information Protection Commission Guidelines: https://law.go.kr/LSW/admRulLsInfoP.do?admRulSeq=2100000240116
|
|
297
|
+
- KISA Cryptography Usage FAQ: https://seed.kisa.or.kr/kisa/bbs/faq.do
|
|
298
|
+
- European Commission GDPR overview: https://commission.europa.eu/law/law-topic/data-protection/reform/what-does-general-data-protection-regulation-gdpr-govern_en
|
|
299
|
+
- European Commission SCC: https://commission.europa.eu/law/law-topic/data-protection/international-dimension-data-protection/standard-contractual-clauses-scc_en
|
|
300
|
+
- California CCPA: https://www.oag.ca.gov/privacy/ccpa
|
|
301
|
+
- HHS HIPAA Privacy Rule: https://www.hhs.gov/hipaa/for-professionals/privacy/index.html
|
|
302
|
+
- NIST Privacy Framework: https://www.nist.gov/privacy-framework
|
|
303
|
+
- Japan PPC APPI: https://www.ppc.go.jp/en/legal/
|
|
304
|
+
- Singapore PDPC: https://www.imda.gov.sg/About-IMDA/Data-Protection/personal-data-protection
|
|
305
|
+
- Canada PIPEDA: https://www.priv.gc.ca/en/privacy-topics/privacy-laws-in-canada/the-personal-information-protection-and-electronic-documents-act-pipeda/pipeda_brief
|
|
306
|
+
- Brazil LGPD: https://www.gov.br/anpd/pt-br/centrais-de-conteudo/outros-documentos-e-publicacoes-institucionais/lgpd-en-lei-no-13-709-capa.pdf/view
|
|
307
|
+
- PCI DSS: https://www.pcisecuritystandards.org/standards/pci-dss/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Release 0.2 구현 범위
|
|
2
|
+
|
|
3
|
+
- 문서 상태: Draft 0.1
|
|
4
|
+
- 작성일: 2026-06-09
|
|
5
|
+
- 관련 제품: Haechi
|
|
6
|
+
|
|
7
|
+
## 1. 목표
|
|
8
|
+
|
|
9
|
+
0.2는 0.1 quickstart 위에 보안 신뢰 경계와 교체 가능성을 보강한다.
|
|
10
|
+
|
|
11
|
+
포함 범위:
|
|
12
|
+
|
|
13
|
+
- local encrypted TokenVault
|
|
14
|
+
- signed policy bundle signing/verification
|
|
15
|
+
- plugin manifest validation
|
|
16
|
+
- MCP stdio JSON-RPC line filter skeleton
|
|
17
|
+
- 관련 CLI와 테스트
|
|
18
|
+
|
|
19
|
+
## 2. CLI 추가
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
node packages/cli/bin/haechi.mjs policy-sign policy.json --out policy.bundle.json
|
|
23
|
+
node packages/cli/bin/haechi.mjs policy-verify policy.bundle.json
|
|
24
|
+
node packages/cli/bin/haechi.mjs plugin-validate examples/plugins/custom-filter.plugin.json
|
|
25
|
+
node packages/cli/bin/haechi.mjs token-reveal <token>
|
|
26
|
+
node packages/cli/bin/haechi.mjs token-purge <token>
|
|
27
|
+
node packages/cli/bin/haechi.mjs mcp-stdio --config haechi.config.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 3. 제외 범위
|
|
31
|
+
|
|
32
|
+
- 외부 Vault/AWS/GCP/Azure KMS 실제 연동
|
|
33
|
+
- plugin code dynamic loading
|
|
34
|
+
- MCP server child process lifecycle management
|
|
35
|
+
- signed release artifact와 SBOM 자동 생성
|
|
36
|
+
- Python SDK
|
|
37
|
+
|
|
38
|
+
## 4. 완료 기준
|
|
39
|
+
|
|
40
|
+
| 기준 | 완료 조건 |
|
|
41
|
+
|---|---|
|
|
42
|
+
| TokenVault | `tokenize` action이 encrypted local vault에 mapping 저장 |
|
|
43
|
+
| Signed policy | policy bundle 서명 검증 실패 시 runtime load 실패 |
|
|
44
|
+
| Plugin manifest | capability와 dataHandling 필드 검증 |
|
|
45
|
+
| MCP stdio | JSON-RPC `params`/`result` payload 보호 |
|
|
46
|
+
| Tests | token vault, policy bundle, plugin manifest, MCP stdio fixture 통과 |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Release 0.2 Implementation Scope
|
|
2
|
+
|
|
3
|
+
- Status: Draft 0.1
|
|
4
|
+
- Date: 2026-06-09
|
|
5
|
+
- Target version: Haechi
|
|
6
|
+
|
|
7
|
+
## 1. Goals
|
|
8
|
+
|
|
9
|
+
0.2 reinforces the security trust boundary and replaceability on top of the 0.1 quickstart.
|
|
10
|
+
|
|
11
|
+
Included scope:
|
|
12
|
+
|
|
13
|
+
- Local encrypted TokenVault
|
|
14
|
+
- Signed policy bundle signing/verification
|
|
15
|
+
- Plugin manifest validation
|
|
16
|
+
- MCP stdio JSON-RPC line filter skeleton
|
|
17
|
+
- Related CLI commands and tests
|
|
18
|
+
|
|
19
|
+
## 2. New CLI Commands
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
node packages/cli/bin/haechi.mjs policy-sign policy.json --out policy.bundle.json
|
|
23
|
+
node packages/cli/bin/haechi.mjs policy-verify policy.bundle.json
|
|
24
|
+
node packages/cli/bin/haechi.mjs plugin-validate examples/plugins/custom-filter.plugin.json
|
|
25
|
+
node packages/cli/bin/haechi.mjs token-reveal <token>
|
|
26
|
+
node packages/cli/bin/haechi.mjs token-purge <token>
|
|
27
|
+
node packages/cli/bin/haechi.mjs mcp-stdio --config haechi.config.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 3. Excluded Scope
|
|
31
|
+
|
|
32
|
+
- Live integration with external Vault/AWS/GCP/Azure KMS
|
|
33
|
+
- Dynamic loading of plugin code
|
|
34
|
+
- MCP server child process lifecycle management
|
|
35
|
+
- Automated generation of signed release artifacts and SBOM
|
|
36
|
+
- Python SDK
|
|
37
|
+
|
|
38
|
+
## 4. Completion Criteria
|
|
39
|
+
|
|
40
|
+
| Criterion | Done When |
|
|
41
|
+
|---|---|
|
|
42
|
+
| TokenVault | `tokenize` action stores mappings in an encrypted local vault |
|
|
43
|
+
| Signed policy | Runtime load fails when policy bundle signature verification fails |
|
|
44
|
+
| Plugin manifest | `capability` and `dataHandling` fields are validated |
|
|
45
|
+
| MCP stdio | JSON-RPC `params`/`result` payloads are protected |
|
|
46
|
+
| Tests | token vault, policy bundle, plugin manifest, and MCP stdio fixtures pass |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Release 0.3 구현 범위
|
|
2
|
+
|
|
3
|
+
- 문서 상태: Draft 0.1
|
|
4
|
+
- 작성일: 2026-06-10
|
|
5
|
+
- 관련 제품: Haechi
|
|
6
|
+
|
|
7
|
+
## 1. 목표
|
|
8
|
+
|
|
9
|
+
0.3은 Haechi를 vLLM, Ollama, llama.cpp 같은 self-hosted/local inference server 앞단에 더 쉽게 붙일 수 있도록 한다.
|
|
10
|
+
|
|
11
|
+
포함 범위:
|
|
12
|
+
|
|
13
|
+
- OpenAI-compatible, vLLM, Ollama, llama.cpp protocol adapter preset
|
|
14
|
+
- request path별 operation 분류와 audit correlation
|
|
15
|
+
- 선택적 JSON response protection
|
|
16
|
+
- `local-inference` policy preset
|
|
17
|
+
- npm publish-ready package metadata, exports, files 목록
|
|
18
|
+
- 0.3.1 safety patch: remote bind guard, streaming fail-closed, response failure policy, audit hash chain, provider injection, CI/SBOM/provenance workflow
|
|
19
|
+
|
|
20
|
+
## 2. 적용 예시
|
|
21
|
+
|
|
22
|
+
### vLLM
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"target": {
|
|
27
|
+
"type": "vllm-openai",
|
|
28
|
+
"upstream": "http://127.0.0.1:8000"
|
|
29
|
+
},
|
|
30
|
+
"policy": {
|
|
31
|
+
"mode": "enforce",
|
|
32
|
+
"presets": ["local-inference"]
|
|
33
|
+
},
|
|
34
|
+
"responseProtection": {
|
|
35
|
+
"enabled": true,
|
|
36
|
+
"mode": "enforce"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Ollama
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"target": {
|
|
46
|
+
"adapter": "ollama",
|
|
47
|
+
"upstream": "http://127.0.0.1:11434"
|
|
48
|
+
},
|
|
49
|
+
"policy": {
|
|
50
|
+
"mode": "enforce",
|
|
51
|
+
"presets": ["local-inference"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### llama.cpp
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"target": {
|
|
61
|
+
"adapter": "llama-cpp",
|
|
62
|
+
"upstream": "http://127.0.0.1:8080"
|
|
63
|
+
},
|
|
64
|
+
"policy": {
|
|
65
|
+
"mode": "enforce",
|
|
66
|
+
"presets": ["local-inference"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 3. 제외 범위
|
|
72
|
+
|
|
73
|
+
- SSE/NDJSON streaming response transformation beyond default fail-closed blocking
|
|
74
|
+
- 이미지/멀티모달 payload 전용 media scanner
|
|
75
|
+
- vendor-specific KMS, Vault, HSM adapter implementation
|
|
76
|
+
- production authentication/authorization gateway
|
|
77
|
+
|
|
78
|
+
## 4. 완료 기준
|
|
79
|
+
|
|
80
|
+
| 기준 | 완료 조건 |
|
|
81
|
+
|---|---|
|
|
82
|
+
| Protocol adapters | vLLM, Ollama, llama.cpp route classification test 통과 |
|
|
83
|
+
| Response protection | upstream JSON 응답의 민감정보가 정책에 따라 변환되고 audit에 평문이 남지 않음 |
|
|
84
|
+
| Package readiness | `npm pack --dry-run` 통과 |
|
|
85
|
+
| Release safety | `npm run release:preflight` 통과 |
|
|
86
|
+
| Regression | 전체 `npm test` 통과 |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Release 0.3 Implementation Scope
|
|
2
|
+
|
|
3
|
+
- Status: Draft 0.1
|
|
4
|
+
- Date: 2026-06-10
|
|
5
|
+
- Target version: Haechi
|
|
6
|
+
|
|
7
|
+
## 1. Goals
|
|
8
|
+
|
|
9
|
+
0.3 makes it easier to place Haechi in front of self-hosted/local inference servers such as vLLM, Ollama, and llama.cpp.
|
|
10
|
+
|
|
11
|
+
Included scope:
|
|
12
|
+
|
|
13
|
+
- OpenAI-compatible, vLLM, Ollama, and llama.cpp protocol adapter presets
|
|
14
|
+
- Per-request-path operation classification and audit correlation
|
|
15
|
+
- Optional JSON response protection
|
|
16
|
+
- `local-inference` policy preset
|
|
17
|
+
- npm publish-ready package metadata, exports, and files list
|
|
18
|
+
- 0.3.1 safety patch: remote bind guard, streaming fail-closed, response failure policy, audit hash chain, provider injection, CI/SBOM/provenance workflow
|
|
19
|
+
|
|
20
|
+
## 2. Usage Examples
|
|
21
|
+
|
|
22
|
+
### vLLM
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"target": {
|
|
27
|
+
"type": "vllm-openai",
|
|
28
|
+
"upstream": "http://127.0.0.1:8000"
|
|
29
|
+
},
|
|
30
|
+
"policy": {
|
|
31
|
+
"mode": "enforce",
|
|
32
|
+
"presets": ["local-inference"]
|
|
33
|
+
},
|
|
34
|
+
"responseProtection": {
|
|
35
|
+
"enabled": true,
|
|
36
|
+
"mode": "enforce"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Ollama
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"target": {
|
|
46
|
+
"adapter": "ollama",
|
|
47
|
+
"upstream": "http://127.0.0.1:11434"
|
|
48
|
+
},
|
|
49
|
+
"policy": {
|
|
50
|
+
"mode": "enforce",
|
|
51
|
+
"presets": ["local-inference"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### llama.cpp
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"target": {
|
|
61
|
+
"adapter": "llama-cpp",
|
|
62
|
+
"upstream": "http://127.0.0.1:8080"
|
|
63
|
+
},
|
|
64
|
+
"policy": {
|
|
65
|
+
"mode": "enforce",
|
|
66
|
+
"presets": ["local-inference"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 3. Excluded Scope
|
|
72
|
+
|
|
73
|
+
- SSE/NDJSON streaming response transformation beyond default fail-closed blocking
|
|
74
|
+
- Dedicated media scanner for image/multimodal payloads
|
|
75
|
+
- Vendor-specific KMS, Vault, and HSM adapter implementations
|
|
76
|
+
- Production authentication/authorization gateway
|
|
77
|
+
|
|
78
|
+
## 4. Completion Criteria
|
|
79
|
+
|
|
80
|
+
| Criterion | Done When |
|
|
81
|
+
|---|---|
|
|
82
|
+
| Protocol adapters | vLLM, Ollama, and llama.cpp route classification tests pass |
|
|
83
|
+
| Response protection | Sensitive data in upstream JSON responses is transformed per policy; no plaintext remains in the audit log |
|
|
84
|
+
| Package readiness | `npm pack --dry-run` passes |
|
|
85
|
+
| Release safety | `npm run release:preflight` passes |
|
|
86
|
+
| Regression | Full `npm test` passes |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Haechi 0.3.2 Hardening Scope
|
|
2
|
+
|
|
3
|
+
- 문서 상태: Final
|
|
4
|
+
- 작성일: 2026-06-10
|
|
5
|
+
- 기준 버전: 0.3.2
|
|
6
|
+
- 성격: 보안 하드닝 릴리스, 첫 npm developer preview 배포 대상
|
|
7
|
+
|
|
8
|
+
## 1. 배경
|
|
9
|
+
|
|
10
|
+
0.3.1 전체 코드 리뷰에서 식별된 16건의 리스크를 해소한 릴리스다. 상세 리스크 목록과 해소 증거는 `risk-register-release-gate.md` 5.2절(P0-SEC-016 ~ P2-DOC-005)을 따른다.
|
|
11
|
+
|
|
12
|
+
npm에 한 번도 배포된 적이 없으므로 0.3.2가 첫 배포 버전이다. 첫 배포를 기능 릴리스(0.4.0)와 분리해 패키지 이름 소유권 확정과 publish 파이프라인(provenance, GitHub release workflow) 검증을 저위험 릴리스에서 먼저 통과시킨다.
|
|
13
|
+
|
|
14
|
+
## 2. 변경 요약
|
|
15
|
+
|
|
16
|
+
### 차단/집행 경로
|
|
17
|
+
- Ollama `/api/chat`·`/api/generate`는 `stream: false` 명시가 없으면 streaming으로 간주, 기본 501 fail-closed (protocol adapter `streamingDefault`)
|
|
18
|
+
- unknown `target.type`은 config 검증 단계에서 fail-closed (`llm-http` alias만 openai-compatible로 허용)
|
|
19
|
+
- upstream fetch에 `limits.upstreamTimeoutMs`(기본 120000) 적용, 초과 시 `504 haechi_upstream_timeout`, 연결 실패 시 `502 haechi_upstream_unreachable`
|
|
20
|
+
- proxy 내부 오류 메시지 일반화 (상세는 stderr)
|
|
21
|
+
|
|
22
|
+
### 탐지/변환
|
|
23
|
+
- JSON number leaf(카드번호 등)와 object key 이름도 detection/transform 대상 (enforce 시 key rename, 충돌은 `#n` suffix)
|
|
24
|
+
- 8자 이하 mask는 전체 마스킹
|
|
25
|
+
- `assignment-secret` 패턴 lookbehind 전환 — key 이름 보존, 값만 치환
|
|
26
|
+
- privacy profile은 `ACTION_STRENGTH` 비교로 사용자 명시 정책을 강화만 가능
|
|
27
|
+
|
|
28
|
+
### 키/암호
|
|
29
|
+
- `decrypt`가 envelope `kid`로 키 선택 (구버전 envelope 복호 유지)
|
|
30
|
+
- `initLocalKeyFile --force`는 기존 키를 `retired`로 보존하는 rotation으로 변경
|
|
31
|
+
- policy bundle 서명 키를 `haechi:policy-bundle:signing:v1` domain-separated 파생 키로 분리
|
|
32
|
+
|
|
33
|
+
### TokenVault/Audit
|
|
34
|
+
- reveal/purge 결정을 audit 기록 (`reveal_allowed/denied/failed`, `purge`, `purge_expired` — 토큰 id만, 평문 불포함)
|
|
35
|
+
- vault mutation 시 만료 토큰 자동 삭제, `purgeExpired()` 및 `haechi token-purge --expired` 추가
|
|
36
|
+
- audit append를 tail-chunk 읽기로 O(1)화
|
|
37
|
+
- audit/vault lock 파일 30초 초과 시 stale 판정 후 자동 탈취
|
|
38
|
+
|
|
39
|
+
### UX/가시성
|
|
40
|
+
- proxy 기동 시와 `protect` 출력에 비집행 모드(dry-run/report-only)·responseProtection 비활성 경고
|
|
41
|
+
- `protect` 출력에 `mode`/`enforced`/`warnings` 필드 추가
|
|
42
|
+
|
|
43
|
+
### MCP
|
|
44
|
+
- notification(id 없는 메시지)은 JSON-RPC 스펙대로 오류 응답 없이 drop
|
|
45
|
+
- batch 배열은 명시적 fail-closed 거부
|
|
46
|
+
|
|
47
|
+
## 3. 호환성 주의 (0.3.1 대비)
|
|
48
|
+
|
|
49
|
+
배포된 사용자가 없으므로 마이그레이션 경로는 제공하지 않고 기록만 남긴다.
|
|
50
|
+
|
|
51
|
+
- 0.3.1 키로 서명한 policy bundle은 서명 키 분리로 검증에 실패한다. `haechi policy-sign`으로 재서명해야 한다.
|
|
52
|
+
- detection 범위 확대(number/key)와 mask 동작 변경으로 enforce 모드 출력이 0.3.1과 다를 수 있다.
|
|
53
|
+
- audit 이벤트 detection 항목에 `kind` 필드가 추가됐다.
|
|
54
|
+
|
|
55
|
+
## 4. 명시적 제외 (0.4+ backlog)
|
|
56
|
+
|
|
57
|
+
- base64/URL-encoded 값 디코딩 후 검사
|
|
58
|
+
- URL query string 검사
|
|
59
|
+
- audit hash chain tail truncation 탐지 (외부 앵커 필요)
|
|
60
|
+
- SSE/NDJSON stream inspection (0.5.0)
|
|
61
|
+
|
|
62
|
+
## 5. 배포 게이트
|
|
63
|
+
|
|
64
|
+
`risk-register-release-gate.md` 7절 체크리스트를 따른다. `npm run release:preflight` 통과 후 인증된 계정에서 `release:preflight:npm` 및 GitHub release workflow로 배포한다.
|