visus-mcp 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/.claude/settings.local.json +9 -1
  2. package/.env.example +55 -0
  3. package/CRYPTO-PROOF-SPEC.md +244 -0
  4. package/README.md +162 -6
  5. package/SECURITY.md +93 -0
  6. package/STATUS.md +166 -4
  7. package/dist/audit/logger.d.ts +90 -0
  8. package/dist/audit/logger.d.ts.map +1 -0
  9. package/dist/audit/logger.js +170 -0
  10. package/dist/audit/logger.js.map +1 -0
  11. package/dist/audit/middleware.d.ts +51 -0
  12. package/dist/audit/middleware.d.ts.map +1 -0
  13. package/dist/audit/middleware.js +138 -0
  14. package/dist/audit/middleware.js.map +1 -0
  15. package/dist/audit/report.d.ts +96 -0
  16. package/dist/audit/report.d.ts.map +1 -0
  17. package/dist/audit/report.js +224 -0
  18. package/dist/audit/report.js.map +1 -0
  19. package/dist/audit/schema.d.ts +128 -0
  20. package/dist/audit/schema.d.ts.map +1 -0
  21. package/dist/audit/schema.js +108 -0
  22. package/dist/audit/schema.js.map +1 -0
  23. package/dist/crypto/primitives.d.ts +188 -0
  24. package/dist/crypto/primitives.d.ts.map +1 -0
  25. package/dist/crypto/primitives.js +192 -0
  26. package/dist/crypto/primitives.js.map +1 -0
  27. package/dist/crypto/proof-builder.d.ts +43 -0
  28. package/dist/crypto/proof-builder.d.ts.map +1 -0
  29. package/dist/crypto/proof-builder.js +110 -0
  30. package/dist/crypto/proof-builder.js.map +1 -0
  31. package/dist/crypto/verifier.d.ts +54 -0
  32. package/dist/crypto/verifier.d.ts.map +1 -0
  33. package/dist/crypto/verifier.js +61 -0
  34. package/dist/crypto/verifier.js.map +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +35 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/lambda-handler.js +1 -1
  39. package/dist/lambda-handler.js.map +1 -1
  40. package/dist/sanitizer/index.d.ts +24 -0
  41. package/dist/sanitizer/index.d.ts.map +1 -1
  42. package/dist/sanitizer/index.js +48 -0
  43. package/dist/sanitizer/index.js.map +1 -1
  44. package/dist/tools/fetch.d.ts.map +1 -1
  45. package/dist/tools/fetch.js +8 -5
  46. package/dist/tools/fetch.js.map +1 -1
  47. package/dist/tools/read.d.ts.map +1 -1
  48. package/dist/tools/read.js +8 -5
  49. package/dist/tools/read.js.map +1 -1
  50. package/dist/tools/report.d.ts +62 -0
  51. package/dist/tools/report.d.ts.map +1 -0
  52. package/dist/tools/report.js +97 -0
  53. package/dist/tools/report.js.map +1 -0
  54. package/dist/tools/search.d.ts.map +1 -1
  55. package/dist/tools/search.js +8 -3
  56. package/dist/tools/search.js.map +1 -1
  57. package/dist/tools/verify.d.ts +48 -0
  58. package/dist/tools/verify.d.ts.map +1 -0
  59. package/dist/tools/verify.js +60 -0
  60. package/dist/tools/verify.js.map +1 -0
  61. package/package.json +1 -1
  62. package/server.json +5 -5
  63. package/src/audit/README.md +177 -0
  64. package/src/audit/logger.ts +285 -0
  65. package/src/audit/middleware.ts +183 -0
  66. package/src/audit/report.ts +304 -0
  67. package/src/audit/schema.ts +272 -0
  68. package/src/crypto/primitives.ts +309 -0
  69. package/src/crypto/proof-builder.ts +166 -0
  70. package/src/crypto/verifier.ts +103 -0
  71. package/src/index.ts +47 -1
  72. package/src/lambda-handler.ts +1 -1
  73. package/src/sanitizer/index.ts +69 -0
  74. package/src/tools/fetch.ts +8 -5
  75. package/src/tools/read.ts +8 -5
  76. package/src/tools/report.ts +122 -0
  77. package/src/tools/search.ts +14 -3
  78. package/src/tools/verify.ts +64 -0
@@ -69,7 +69,15 @@
69
69
  "Bash(/tmp/mcp-publisher login:*)",
70
70
  "Bash(/tmp/mcp-publisher publish:*)",
71
71
  "WebFetch(domain:airc.nist.gov)",
72
- "WebFetch(domain:csf.tools)"
72
+ "WebFetch(domain:csf.tools)",
73
+ "Bash(npx ts-node:*)",
74
+ "Bash(npx tsc:*)",
75
+ "Bash(npm --version:*)",
76
+ "Bash(env)",
77
+ "Bash(.gitignore)",
78
+ "Bash(npm whoami:*)",
79
+ "Bash(npm login:*)",
80
+ "Bash(~/.npmrc)"
73
81
  ],
74
82
  "deny": [],
75
83
  "ask": []
package/.env.example ADDED
@@ -0,0 +1,55 @@
1
+ # Visus-MCP Environment Configuration
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # =======================================
5
+ # Cryptographic Configuration
6
+ # =======================================
7
+
8
+ # REQUIRED for production proof signatures.
9
+ # Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
10
+ # Minimum length: 32 bytes (64 hex chars recommended)
11
+ # Rotate: on compromise, on personnel change, on annual audit cycle
12
+ VISUS_HMAC_SECRET=
13
+
14
+ # =======================================
15
+ # Audit Configuration
16
+ # =======================================
17
+
18
+ # DynamoDB audit table name
19
+ VISUS_AUDIT_TABLE=visus-audit-log
20
+
21
+ # AWS region for DynamoDB
22
+ AWS_REGION=us-east-1
23
+
24
+ # Set to "true" to make audit write failures propagate (fail-closed)
25
+ # Default "false" = fail-open (audit failure does not break tool call)
26
+ AUDIT_FAIL_CLOSED=false
27
+
28
+ # Set to "false" to disable audit logging (dev/test only)
29
+ VISUS_AUDIT_ENABLED=true
30
+
31
+ # =======================================
32
+ # Browser Configuration (optional)
33
+ # =======================================
34
+
35
+ # Fetch timeout in milliseconds
36
+ VISUS_TIMEOUT_MS=10000
37
+
38
+ # Max content size before truncation (in KB)
39
+ VISUS_MAX_CONTENT_KB=512
40
+
41
+ # =======================================
42
+ # Lambda Configuration (Hosted tier only)
43
+ # =======================================
44
+
45
+ # Lambda function ARN (set by CDK)
46
+ # LAMBDA_FUNCTION_ARN=
47
+
48
+ # API Gateway endpoint (set by CDK)
49
+ # API_GATEWAY_ENDPOINT=
50
+
51
+ # Cognito User Pool ID (set by CDK)
52
+ # COGNITO_USER_POOL_ID=
53
+
54
+ # Cognito App Client ID (set by CDK)
55
+ # COGNITO_APP_CLIENT_ID=
@@ -0,0 +1,244 @@
1
+ # Visus-MCP Cryptographic Proof Specification
2
+
3
+ Version: 1.0.0
4
+ Status: Normative
5
+ Regulatory basis: EU AI Act Art. 9, 11, 13, 15 | GDPR Art. 5(2), 32
6
+
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ This document specifies the cryptographic proof scheme used by Visus-MCP to
12
+ provide verifiable, tamper-evident evidence that its prompt injection
13
+ sanitization pipeline executed before any web content was forwarded to a
14
+ large language model.
15
+
16
+ Any third party — regulator, DPA, conformity assessment body, or security
17
+ researcher — can independently verify any Visus-MCP proof record using only
18
+ this specification and standard SHA-256 / HMAC-SHA-256 implementations.
19
+
20
+ ---
21
+
22
+ ## Proof Fields
23
+
24
+ Every Visus-MCP tool response includes a `visus_proof` object with these fields:
25
+
26
+ | Field | Type | Description |
27
+ |---|---|---|
28
+ | `request_id` | hex string (32 chars) | Unique identifier for this tool call |
29
+ | `proof_hash` | hex string (64 chars) | SHA-256 commitment over all proof fields |
30
+ | `chain_hash` | hex string (64 chars) | Links this proof to previous proof |
31
+ | `injection_detected` | boolean | Whether any injection pattern fired |
32
+ | `patterns_evaluated` | integer | Total patterns checked |
33
+ | `patterns_triggered` | integer | Patterns that fired |
34
+ | `redactions` | integer | Number of redactions applied |
35
+ | `sanitization_applied` | boolean | Whether content was modified |
36
+ | `timestamp_utc` | ISO 8601 string | When sanitization completed |
37
+ | `pipeline_version` | semver string | Sanitization library version |
38
+ | `schema_version` | semver string | Proof schema version |
39
+
40
+ The `proof_signature` (HMAC) is stored in the audit log but **not** returned
41
+ in tool responses. It is disclosed only to authorised auditors.
42
+
43
+ ---
44
+
45
+ ## Proof Hash Computation
46
+
47
+ The `proof_hash` is computed as:
48
+
49
+ ```
50
+ proof_hash = SHA-256(canonical_string)
51
+
52
+ canonical_string = join([
53
+ request_id,
54
+ input_hash,
55
+ output_hash,
56
+ sorted(triggered_pattern_ids).join(","),
57
+ str(patterns_evaluated),
58
+ timestamp_utc,
59
+ pipeline_version,
60
+ ], separator="\x00|\x00")
61
+ ```
62
+
63
+ Where:
64
+
65
+ - `input_hash = SHA-256(raw_content_utf8)` — hash of content BEFORE sanitization
66
+ - `output_hash = SHA-256(sanitized_content_utf8)` — hash of content AFTER sanitization
67
+ - `triggered_pattern_ids` = sorted lexicographically before joining
68
+ - All string encoding is UTF-8
69
+ - The field separator `\x00|\x00` (null-pipe-null) prevents field boundary ambiguity
70
+
71
+ ---
72
+
73
+ ## Proof Signature Computation
74
+
75
+ ```
76
+ proof_signature = HMAC-SHA-256(proof_hash, VISUS_HMAC_SECRET)
77
+ ```
78
+
79
+ The signature is disclosed to authorised auditors under NDA. It proves the
80
+ proof was issued by a pipeline instance holding the secret key, not forged
81
+ by an external observer.
82
+
83
+ ---
84
+
85
+ ## Chain Hash Computation
86
+
87
+ ```
88
+ chain_hash = SHA-256(previous_proof_hash + "\x00|\x00" + current_proof_hash)
89
+ ```
90
+
91
+ - First record: `previous_proof_hash = "GENESIS"`
92
+ - The chain allows auditors to detect gaps (deleted records) or reordering.
93
+
94
+ ---
95
+
96
+ ## Verification Procedure
97
+
98
+ ### Hash-only verification (no signing key required)
99
+
100
+ 1. Obtain `request_id`, `timestamp_utc`, `pipeline_version`, `patterns_evaluated`, `patterns_triggered` from the `visus_proof` object
101
+ 2. Obtain `input_hash` and `output_hash` from the audit log record
102
+ 3. Obtain `triggered_pattern_ids` (list) from the audit log record
103
+ 4. Recompute `canonical_string` using the formula above
104
+ 5. Compute `SHA-256(canonical_string)`
105
+ 6. Compare against `proof_hash` — must match byte-for-byte
106
+
107
+ ### Full cryptographic verification (requires signing key)
108
+
109
+ 1. Perform hash-only verification first
110
+ 2. Compute `HMAC-SHA-256(recomputed_proof_hash, VISUS_HMAC_SECRET)`
111
+ 3. Compare against `proof_signature` from audit log — must match byte-for-byte
112
+
113
+ ### Using the `visus_verify` MCP tool
114
+
115
+ ```json
116
+ {
117
+ "tool": "visus_verify",
118
+ "input": {
119
+ "proof": { "<paste the visus_proof object here>" },
120
+ "signingKey": "<VISUS_HMAC_SECRET — omit for hash-only>"
121
+ }
122
+ }
123
+ ```
124
+
125
+ ### Using the CLI verifier
126
+
127
+ ```bash
128
+ # TypeScript
129
+ echo '{"proof": {...}, "signingKey": "..."}' | \
130
+ node dist/crypto/verifier.js
131
+
132
+ # Exit code 0 = valid, 1 = invalid, 2 = parse error
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Regulatory Mapping
138
+
139
+ | Proof Component | EU AI Act | GDPR |
140
+ |---|---|---|
141
+ | `input_hash` + `output_hash` | Art. 15 Robustness — proves pipeline ran | Art. 32 Security — cryptographic evidence |
142
+ | `proof_hash` | Art. 9 Risk Management — tamper-evident record | Art. 5(2) Accountability — verifiable |
143
+ | `proof_signature` (audit-only) | Art. 11 Technical Documentation | Art. 32(1)(d) Regular testing evidence |
144
+ | `chain_hash` | Art. 9 Risk Management — deletion detection | Art. 5(2) Accountability |
145
+ | `visus_verify` tool | Art. 13 Transparency — callable verification | Art. 30 Records — machine-readable |
146
+ | `patterns_evaluated` / `patterns_triggered` | Art. 9(4) Risk Management documentation | Art. 32 — evidence of controls |
147
+
148
+ ### Presumption of Conformity Path
149
+
150
+ Deployers can reference this specification as part of the technical
151
+ documentation required under EU AI Act Annex IV. The `visus_verify` tool
152
+ constitutes the "testing, validation and verification procedures" required
153
+ by Annex IV §2(f).
154
+
155
+ ---
156
+
157
+ ## Security Properties
158
+
159
+ | Property | Mechanism | Guarantee |
160
+ |---|---|---|
161
+ | **Tamper evidence** | SHA-256 over all fields | Any field change invalidates proof_hash |
162
+ | **Authenticity** | HMAC-SHA-256 with secret key | Proves pipeline issued the proof |
163
+ | **Non-repudiation** | Audit log + chain_hash | Deletion of records is detectable |
164
+ | **Privacy preservation** | Hashes only, no raw content | Verification without data exposure |
165
+ | **Timing safety** | `timingSafeEqual` / `hmac.compare_digest` | No timing oracle on verification |
166
+ | **Ordering proof** | Chain hash | Record sequence is tamper-evident |
167
+
168
+ ---
169
+
170
+ ## Reference Implementation Test Vectors
171
+
172
+ Use these to verify your implementation is correct:
173
+
174
+ ### Input:
175
+ ```
176
+ request_id = "test-request-id-0000"
177
+ input_hash = SHA-256("raw content")
178
+ = "a6e5d15bf571ca7a23fd704caad6c4c071210ba8d38ea0296dc58c3ce0a0e514"
179
+ output_hash = SHA-256("clean content")
180
+ = "573b1d8589d0623b86749785dae7a299483d140d551299578f0fcb30bdcece28"
181
+ triggered_pattern_ids = ["PI-001", "PI-007"] (sort → ["PI-001","PI-007"])
182
+ patterns_evaluated = 43
183
+ timestamp_utc = "2026-03-26T00:00:00.000Z"
184
+ pipeline_version = "1.0.0"
185
+
186
+ canonical_string = "test-request-id-0000\x00|\x00a6e5d15bf571ca7a23fd704caad6c4c071210ba8d38ea0296dc58c3ce0a0e514\x00|\x00573b1d8589d0623b86749785dae7a299483d140d551299578f0fcb30bdcece28\x00|\x00PI-001,PI-007\x00|\x0043\x00|\x002026-03-26T00:00:00.000Z\x00|\x001.0.0"
187
+ ```
188
+
189
+ ### Expected Output:
190
+ ```
191
+ proof_hash = "9cda5595b2f9865e1f1f50ac366a79daa488bd85db02551c20c3de22a65c902d"
192
+
193
+ signing_key = "test-signing-key-for-spec-vectors-only-000000"
194
+ proof_signature = "0d7a6102117ed1c6d5ceb8dcc132000f96ddf3d1c4a97bf18328063dded959b5"
195
+ ```
196
+
197
+ ### Verification:
198
+
199
+ Recompute the `proof_hash` from the inputs above. It must match exactly. Then compute the HMAC signature using the test signing key. It must also match exactly.
200
+
201
+ If either hash does not match, your implementation is incorrect. Common causes:
202
+ - Field ordering wrong in canonical string
203
+ - Separator string incorrect (must be `\x00|\x00`)
204
+ - Pattern IDs not sorted lexicographically
205
+ - Encoding not UTF-8
206
+ - Extra whitespace or newlines in canonical string
207
+
208
+ ---
209
+
210
+ ## Compliance Checklist
211
+
212
+ For deployers preparing for conformity assessment under EU AI Act:
213
+
214
+ - [ ] `VISUS_HMAC_SECRET` configured in production (minimum 32 bytes)
215
+ - [ ] Audit logging enabled (`VISUS_AUDIT_ENABLED=true`)
216
+ - [ ] Audit records retained for 90 days minimum
217
+ - [ ] `visus_verify` tool accessible to auditors
218
+ - [ ] Test vectors verified against your deployment
219
+ - [ ] Chain tip persisted across server restarts (if applicable)
220
+ - [ ] HMAC key rotation procedure documented
221
+ - [ ] Incident response plan for key compromise
222
+ - [ ] Data sharing agreement covers proof signature disclosure to DPAs
223
+ - [ ] Technical documentation references this specification
224
+
225
+ ---
226
+
227
+ ## Changelog
228
+
229
+ | Version | Date | Changes |
230
+ |---|---|---|
231
+ | 1.0.0 | 2026-03-28 | Initial release — comprehensive cryptographic proof system |
232
+
233
+ ---
234
+
235
+ ## Contact
236
+
237
+ For questions about this specification or security disclosures:
238
+
239
+ - Email: security@lateos.ai
240
+ - GitHub: https://github.com/visus-mcp/visus-mcp/security
241
+
242
+ ---
243
+
244
+ **End of Specification**
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # Visus — Secure Web Access for Claude
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/visus-mcp?color=crimson&label=npm)](https://www.npmjs.com/package/visus-mcp)
4
- [![tests](https://img.shields.io/badge/tests-294%20passing-brightgreen)](https://github.com/visus-mcp/visus-mcp)
5
- [![tools](https://img.shields.io/badge/MCP%20tools-4-blue)](https://github.com/visus-mcp/visus-mcp)
4
+ [![tests](https://img.shields.io/badge/tests-323%20passing-brightgreen)](https://github.com/visus-mcp/visus-mcp)
5
+ [![tools](https://img.shields.io/badge/MCP%20tools-5-blue)](https://github.com/visus-mcp/visus-mcp)
6
6
  [![mcp](https://img.shields.io/badge/MCP-compatible-brightgreen)](https://modelcontextprotocol.io)
7
7
  [![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/visus-mcp/visus-mcp/blob/main/LICENSE)
8
8
  [![security](https://img.shields.io/badge/frameworks-NIST%20AI%20RMF%20%7C%20CSF%202.0%20%7C%20OWASP%20%7C%20MITRE%20%7C%20ISO42001-orange)](https://github.com/visus-mcp/visus-mcp/blob/main/SECURITY.md)
9
9
  [![iso42001](https://img.shields.io/badge/ISO%2FIEC-42001%3A2023-blueviolet)](https://www.iso.org/standard/81230.html)
10
+ [![euaiact](https://img.shields.io/badge/EU%20AI%20Act-Art.%209%2F13%2F15-blue)](https://github.com/visus-mcp/visus-mcp/blob/main/CRYPTO-PROOF-SPEC.md)
10
11
 
11
12
  > **Your AI agent shouldn't have to read garbage.**
12
13
  > **visus-mcp makes sure it doesn't.**
@@ -19,7 +20,7 @@ Claude handles most of it. But it still has to read all of it first. You still p
19
20
 
20
21
  Built as infrastructure, not a replacement for Claude's own safety training. The two layers together are stronger than either alone.
21
22
  ```bash
22
- npx visus-mcp@0.9.0
23
+ npx visus-mcp@0.10.0
23
24
  ```
24
25
 
25
26
  *"What the web shows you, Lateos reads safely."*
@@ -50,7 +51,8 @@ visus-mcp fetches the same page and delivers:
50
51
  URL → Playwright Render → Content-Type Detection
51
52
  → Specialized Handlers (PDF/JSON/SVG) OR HTML Pipeline
52
53
  → Injection Sanitizer (43 patterns) → PII Redactor
53
- → Token Ceiling (24k cap) → Clean Content → Claude
54
+ Cryptographic Proof Generation → Token Ceiling (24k cap)
55
+ → Clean Content + Proof → Claude
54
56
  ```
55
57
 
56
58
  ### Security Pipeline
@@ -63,9 +65,10 @@ URL → Playwright Render → Content-Type Detection
63
65
  - **HTML/XML/RSS** — Uses existing conversion and reader extraction pipeline
64
66
  3. **Injection Detection**: 43 pattern categories scan for prompt injection attempts
65
67
  4. **PII Redaction**: Emails, phone numbers, SSNs, credit cards, and IP addresses are redacted
66
- 5. **Clean Delivery**: Stripped, formatted, token-efficient content reaches your LLM with a compliance report attached if anything was flagged
68
+ 5. **Cryptographic Proof**: SHA-256 + HMAC-SHA-256 proof that sanitization ran (EU AI Act Art. 9/13/15 compliance)
69
+ 6. **Clean Delivery**: Stripped, formatted, token-efficient content reaches your LLM — with a `visus_proof` header and compliance report attached if anything was flagged
67
70
 
68
- **This pipeline runs before content enters Claude's context window** — reducing token consumption, keeping PII out of conversation history, and generating audit logs when injection patterns are detected.
71
+ **This pipeline runs before content enters Claude's context window** — reducing token consumption, keeping PII out of conversation history, generating audit logs when injection patterns are detected, and producing tamper-evident cryptographic proofs that sanitization executed.
69
72
 
70
73
  ---
71
74
 
@@ -300,6 +303,114 @@ Extract structured data from a web page according to a schema. Includes NIST AI
300
303
 
301
304
  All extracted fields are individually sanitized.
302
305
 
306
+ ### `visus_verify`
307
+
308
+ **NEW in v0.10.0:** Verify a Visus-MCP sanitization proof record. Confirms that a specific request was processed by the Visus injection detection pipeline before content reached the LLM. Produces a compliance statement suitable for EU AI Act Art. 9/13 documentation and GDPR Art. 32 security evidence.
309
+
310
+ **Input:**
311
+ ```json
312
+ {
313
+ "proof": {
314
+ "request_id": "abc123...",
315
+ "proof_hash": "9cda5595...",
316
+ "chain_hash": "977f5566...",
317
+ "injection_detected": false,
318
+ "patterns_evaluated": 43,
319
+ "patterns_triggered": 0,
320
+ "timestamp_utc": "2026-03-28T12:00:00Z",
321
+ "pipeline_version": "1.0.0",
322
+ "schema_version": "1.0.0"
323
+ },
324
+ "signingKey": "optional-for-full-verification"
325
+ }
326
+ ```
327
+
328
+ **Output:**
329
+ ```json
330
+ {
331
+ "valid": true,
332
+ "checks": {
333
+ "proofHashMatch": true,
334
+ "signatureMatch": true,
335
+ "schemaVersionMatch": true
336
+ },
337
+ "complianceStatement": "VERIFIED: Request abc123 was processed by Visus-MCP sanitization pipeline v1.0.0 at 2026-03-28T12:00:00Z. Proof hash 9cda5595... recomputed and confirmed. 43 injection patterns evaluated, 0 triggered, 0 redactions applied. Sanitized content reached LLM only after this processing completed. Verified at 2026-03-28T12:30:00Z. EU AI Act Art. 9/13/15 controls confirmed active for this request.",
338
+ "recomputedProofHash": "9cda5595...",
339
+ "verifiedAt": "2026-03-28T12:30:00Z",
340
+ "requestId": "abc123...",
341
+ "issues": []
342
+ }
343
+ ```
344
+
345
+ **Use Cases:**
346
+ - Regulatory audit responses (DPA, conformity assessment)
347
+ - Internal compliance verification
348
+ - Third-party security assessments
349
+ - Incident investigation and forensics
350
+
351
+ See [CRYPTO-PROOF-SPEC.md](./CRYPTO-PROOF-SPEC.md) for the complete technical specification.
352
+
353
+ ---
354
+
355
+ ## Cryptographic Proof System
356
+
357
+ **NEW in v0.10.0:** Every Visus tool response now includes a `visus_proof` object providing tamper-evident cryptographic evidence that sanitization executed. This satisfies EU AI Act Art. 9 (Risk Management), Art. 13 (Transparency), and Art. 15 (Robustness) requirements.
358
+
359
+ ### What's in a Proof?
360
+
361
+ ```json
362
+ {
363
+ "visus_proof": {
364
+ "request_id": "0b9564ea943c3909...",
365
+ "proof_hash": "a7cbc0e4a158dc4e...",
366
+ "chain_hash": "977f55664549b4b2...",
367
+ "injection_detected": false,
368
+ "patterns_evaluated": 43,
369
+ "patterns_triggered": 0,
370
+ "redactions": 0,
371
+ "sanitization_applied": false,
372
+ "timestamp_utc": "2026-03-28T12:00:00.000Z",
373
+ "pipeline_version": "1.0.0",
374
+ "schema_version": "1.0.0",
375
+ "verify_instruction": "Recompute proof_hash from disclosed fields per visus-mcp/CRYPTO-PROOF-SPEC.md"
376
+ }
377
+ }
378
+ ```
379
+
380
+ ### How It Works
381
+
382
+ 1. **Before sanitization**: Generate unique request ID and timestamp
383
+ 2. **During sanitization**: Run full injection detection + PII redaction pipeline
384
+ 3. **After sanitization**: Compute cryptographic proof:
385
+ - `proof_hash` = SHA-256(request_id + input_hash + output_hash + patterns + timestamp + version)
386
+ - `proof_signature` = HMAC-SHA-256(proof_hash, VISUS_HMAC_SECRET) — stored in audit log only
387
+ - `chain_hash` = SHA-256(previous_proof_hash + current_proof_hash) — detects deleted records
388
+
389
+ 4. **Verification**: Anyone can verify the proof by recomputing the proof_hash from the disclosed fields
390
+
391
+ ### Security Properties
392
+
393
+ | Property | Mechanism | Guarantee |
394
+ |----------|-----------|-----------|
395
+ | **Tamper evidence** | SHA-256 over all fields | Any field change invalidates proof_hash |
396
+ | **Authenticity** | HMAC-SHA-256 with secret key | Proves pipeline issued the proof |
397
+ | **Non-repudiation** | Audit log + chain_hash | Deletion of records is detectable |
398
+ | **Privacy preservation** | Hashes only, no raw content | Verification without data exposure |
399
+
400
+ ### For Regulators and Auditors
401
+
402
+ - **Hash-only verification**: Recompute `proof_hash` from disclosed fields (no key required)
403
+ - **Full cryptographic verification**: Verify `proof_signature` with `VISUS_HMAC_SECRET` (shared under NDA)
404
+ - **Independent verification**: Use the `visus_verify` tool or CLI verifier
405
+ - **Compliance statements**: Automatically generated for DPA submissions
406
+
407
+ See [CRYPTO-PROOF-SPEC.md](./CRYPTO-PROOF-SPEC.md) for:
408
+ - Complete technical specification
409
+ - Verification procedures
410
+ - Reference implementation test vectors
411
+ - Regulatory mapping (EU AI Act / GDPR)
412
+ - Deployer compliance checklist
413
+
303
414
  ---
304
415
 
305
416
  ## Threat Reporting
@@ -884,4 +995,49 @@ A: Yes! Open-source tier is free forever. Phase 2 will introduce a hosted tier w
884
995
 
885
996
  ---
886
997
 
998
+ ## EU Regulatory Compliance
999
+
1000
+ Visus-MCP is designed with EU AI Act and GDPR principles as first-class architectural constraints, not afterthoughts. This section provides a mapping between Visus features and the specific regulatory articles they address, enabling integrators to build toward **presumption of conformity** via the EU AI Act Code of Practice and harmonised standards under CEN/CENELEC JTC 21.
1001
+
1002
+ ### Feature → Regulation Mapping
1003
+
1004
+ | Visus-MCP Feature | EU AI Act Article | GDPR Article | Regulatory Rationale |
1005
+ |---|---|---|---|
1006
+ | Prompt injection sanitization (43 validated patterns) | Art. 9 — Risk Management System | Art. 32 — Security of Processing | Mandatory technical measures to prevent adversarial manipulation of AI outputs |
1007
+ | Untrusted-by-default web content model | Art. 9 — Risk Management System | Art. 5(1)(f) — Integrity & Confidentiality | Treats all external input as hostile; maps to adversarial robustness requirement in Code of Practice Measure 2.5 |
1008
+ | No raw external content forwarded to LLM | Art. 15 — Robustness, Accuracy & Cybersecurity | Art. 5(1)(c) — Data Minimisation | Only sanitized, stripped content reaches the model; reduces attack surface and unnecessary data exposure |
1009
+ | Content sanitization before AI processing | Art. 15 — Robustness, Accuracy & Cybersecurity | Art. 25 — Data Protection by Design | Sanitization is enforced at ingestion, not as an optional post-processing step |
1010
+ | Stateless fetch architecture (no session persistence) | Art. 10 — Data & Data Governance | Art. 5(1)(e) — Storage Limitation | No user browsing data retained beyond the immediate request |
1011
+ | Open-source, auditable codebase | Art. 13 — Transparency & Provision of Information | Art. 5(2) — Accountability | Full auditability for conformity assessment bodies and data protection authorities |
1012
+ | SECURITY-AUDIT-v1.md (planned red team disclosure) | Art. 9 — Risk Management + Code of Practice §4 Adversarial Testing | Art. 32(1)(d) — Regular Testing | Aligns with EDPS guidance on AI risk management: document threats, test mitigations, publish findings |
1013
+ | MCP endpoint scoped permissions | Art. 9 — Risk Management System | Art. 25 — Data Protection by Design | Least-privilege access model; each tool call scoped to minimum required capability |
1014
+
1015
+ ### EU AI Act Code of Practice Alignment
1016
+
1017
+ The EU AI Act Code of Practice (General-Purpose AI, published 2025) identifies adversarial testing and mitigation documentation as key obligations for AI system providers. Visus-MCP addresses these through:
1018
+
1019
+ - **Measure 2.5 (Adversarial Robustness):** Prompt injection defense is the primary threat model. The 43-pattern detection library directly addresses adversarial input manipulation.
1020
+ - **Measure 4.1 (Incident Reporting Preparedness):** The planned `SECURITY-AUDIT-v1.md` constitutes a pre-emptive disclosure document that regulators can use to assess risk management maturity.
1021
+ - **Measure 1.2 (Capability Transparency):** The open-source architecture and this compliance mapping serve as the transparency artifact required under Art. 13.
1022
+
1023
+ ### EDPS Guidance on AI Risk Management
1024
+
1025
+ The European Data Protection Supervisor's *Guidelines on AI and Data Protection* (2022, updated 2024) require that AI systems processing content on behalf of users implement:
1026
+
1027
+ 1. **Risk identification at ingestion** — Visus sanitizes at the fetch layer before any data reaches the AI model.
1028
+ 2. **Technical measures proportionate to risk** — Stateless architecture and data minimisation limit blast radius of any breach.
1029
+ 3. **Accountability documentation** — This mapping table, combined with `SECURITY.md` and `STATUS.md`, constitutes the technical documentation required under GDPR Art. 30 (Records of Processing) for AI-assisted data handling.
1030
+
1031
+ ### Presumption of Conformity Path
1032
+
1033
+ Integrators deploying Visus-MCP in EU contexts can reference this mapping to support conformity claims under:
1034
+
1035
+ - **EN ISO/IEC 42001** (AI Management Systems) — risk management and data governance controls
1036
+ - **ETSI EN 303 645** (Cyber Security for Consumer IoT, applicable by analogy to AI agents)
1037
+ - **EU AI Act Annex IV** (Technical Documentation) — this section, `SECURITY.md`, and `STATUS.md` together form a substantive portion of the required technical file
1038
+
1039
+ > **Note:** Visus-MCP is an open-source tool. Conformity assessment obligations apply to the deploying organisation, not to the upstream open-source component. This documentation is provided to assist deployers in meeting their obligations.
1040
+
1041
+ ---
1042
+
887
1043
  **Built with by Lateos**
package/SECURITY.md CHANGED
@@ -357,6 +357,99 @@ We take security seriously. If you discover a vulnerability in Visus:
357
357
 
358
358
  ---
359
359
 
360
+ ## EU AI Act & GDPR Compliance Mapping
361
+
362
+ ### Threat Model → Regulatory Mapping
363
+
364
+ The Visus-MCP security architecture is explicitly mapped to EU AI Act and GDPR obligations. The following table cross-references each security control with its regulatory basis.
365
+
366
+ | Security Control | Threat Mitigated | EU AI Act Article | GDPR Article |
367
+ |---|---|---|---|
368
+ | Prompt injection sanitization | Adversarial manipulation of AI reasoning | Art. 9 — Risk Management | Art. 32 — Security of Processing |
369
+ | Untrusted-by-default content model | Supply chain / web content injection | Art. 15 — Robustness & Cybersecurity | Art. 5(1)(f) — Integrity & Confidentiality |
370
+ | Stateless fetch (no session storage) | Persistent tracking / data leakage | Art. 10 — Data Governance | Art. 5(1)(e) — Storage Limitation |
371
+ | Minimal data forwarding to LLM | Unnecessary PII exposure to AI model | Art. 15 — Accuracy & Data Quality | Art. 5(1)(c) — Data Minimisation |
372
+ | Open audit trail (this document) | Opacity / unverifiable security claims | Art. 13 — Transparency | Art. 5(2) — Accountability |
373
+ | Scoped MCP permissions | Privilege escalation via tool calls | Art. 9 — Risk Management | Art. 25 — Data Protection by Design |
374
+
375
+ ### EU AI Act Code of Practice: Adversarial Testing Requirements
376
+
377
+ Under the EU AI Act Code of Practice for General-Purpose AI Models (2025), providers are expected to conduct and document adversarial testing. For Visus-MCP this means:
378
+
379
+ **What we test:**
380
+ - Prompt injection via crafted web page content (direct and indirect)
381
+ - Instruction smuggling via HTML comments, meta tags, and hidden DOM elements
382
+ - Encoding-based evasion (Base64, Unicode normalization attacks, homoglyph substitution)
383
+ - Multi-turn injection via session context manipulation
384
+
385
+ **How we document it:**
386
+ - `SECURITY-AUDIT-v1.md` (planned): A public red team disclosure document covering methodology, findings, and mitigations. This directly satisfies Code of Practice Measure 4.1 (incident and vulnerability disclosure preparedness).
387
+
388
+ **EDPS AI Risk Management Guidance:**
389
+ The European Data Protection Supervisor recommends that AI systems document the following for each data processing operation:
390
+ 1. The AI capability being exercised (fetch + sanitize + forward)
391
+ 2. The data flows involved (external URL → sanitization layer → LLM context)
392
+ 3. The risk mitigations applied (stateless, no persistence, injection filtering)
393
+ 4. The residual risk and monitoring approach (open-source auditability, community disclosure)
394
+
395
+ Visus-MCP addresses all four points through this document, `README.md`, and `STATUS.md`.
396
+
397
+ ### Reporting Security Issues
398
+
399
+ See the main [Vulnerability Disclosure](#vulnerability-disclosure) section above for responsible disclosure procedures. For EU-specific regulatory concerns (e.g., potential GDPR Art. 33 notification obligations arising from a Visus-MCP vulnerability), please include "EU-REGULATORY" in the subject line of your disclosure.
400
+
401
+ ---
402
+
403
+ ## HMAC Signing Key Management (VISUS_HMAC_SECRET)
404
+
405
+ The `VISUS_HMAC_SECRET` is used to sign all sanitization proof records.
406
+ It must be treated as a high-value secret.
407
+
408
+ ### Generation
409
+
410
+ ```bash
411
+ # Node.js
412
+ node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
413
+
414
+ # Python (if applicable)
415
+ python3 -c "import secrets; print(secrets.token_hex(32))"
416
+ ```
417
+
418
+ ### Storage
419
+
420
+ Use AWS Secrets Manager, not .env files in production.
421
+
422
+ ### Rotation triggers
423
+
424
+ - Personnel change with access to the secret
425
+ - Suspected compromise
426
+ - Annual audit cycle (recommended)
427
+ - Any infrastructure credential rotation event
428
+
429
+ ### On rotation
430
+
431
+ Old proof_signatures will no longer verify against the new key.
432
+ Retain the old key (in Secrets Manager, versioned) for audit purposes during
433
+ the 90-day record retention window.
434
+
435
+ ### Disclosure to auditors
436
+
437
+ Share under NDA with conformity assessment bodies
438
+ or DPAs requiring full cryptographic verification of proof records.
439
+ GDPR Art. 32 requires "appropriate technical measures" — the HMAC key is
440
+ a controlled measure and its disclosure is governed by your data sharing agreements.
441
+
442
+ ### Compromise response
443
+
444
+ If the HMAC key is compromised:
445
+ 1. Immediately rotate to a new key
446
+ 2. Audit all proof records signed with the compromised key
447
+ 3. Determine if any proofs were forged (check against original audit logs)
448
+ 4. Notify affected parties if required under GDPR Art. 33 / 34
449
+ 5. Document incident in security log
450
+
451
+ ---
452
+
360
453
  **Built with by Lateos**
361
454
 
362
455
  For questions: **security@lateos.ai**