Run — Code-Review mcp-replicate-hosted (Multi-Persona, Phase A geshipped)
Anschluss-Lauf an security-audit. Voller Multi-Persona-Code-Review der beiden bisherigen Commits (068a210 + d22c3f5) durch 6 parallele compound-engineering-Reviewer.
Konvergenz-Map (Findings die mehrere Reviewer unabhaengig sahen)
| Finding | Reviewer | Severity |
|---|---|---|
_TOOL_CATALOG-Vergiftung bei Sub-MCP-Spawn-Fail | correctness HIGH + adversarial HIGH | HIGH (doppelt) |
_extract_model_arg silent-bypass bei malformed Args | testing HIGH + correctness MED | HIGH (doppelt) |
_normalize_tool_result ungetestet, 5 Defensive-Branches | kieran + maintainability + testing | MED (3-fach) |
| PLACEHOLDER-Strings im CDK durchrutschend | adversarial + security | MED (doppelt) |
search_tools-Filter ist Defense-in-Depth-Invariante ohne Test | testing + adversarial | MED (doppelt) |
Phase-A-Fixes (geshipped — commit 50121f9)
| ID | Severity | Fix |
|---|---|---|
| H1 | HIGH | _get_tool_catalog cached nur bei voll-success, partial-result wird zurueckgegeben aber nicht persistiert |
| H2 | HIGH | _extract_model_arg returnt Sentinel _INVALID_MODEL_ARG bei malformed → GuardMiddleware hard-RuntimeError + Audit model_arg_malformed |
| M1 | MED | test_all_use_case_defaults_in_whitelist — Drift-Schutz fuer Layer-Tool-Defaults |
| M2 | MED | test_search_tools_filter_matches_guard_allowlist — pinned dass Discovery + Enforcement dieselbe Allow-Liste nutzen |
| M3 | MED | test_register_prompts_registers_exactly_three_named_prompts — vorher false-confidence-Pattern (assertete app.name) |
| M4 | MED | requireNoPlaceholder() Pre-Synth-Guard im CDK-Stack — cdk synth bricht jetzt loud ab |
| M5 | MED | _normalize_tool_result fail-fast (RuntimeError) statt {"_raw"}/{"_text"}/{"_value"}-Wrap — FastMCP-API-Drift wird sofort als tool_error im Audit sichtbar |
Tests: 107/107 gruen (vorher 84). Neue Test-Datei test_normalize_and_catalog.py mit 11 Cases (8 fail-fast + 3 Catalog-Cache-Paths inkl. Recovery-After-Failure). 11 weitere Cases in bestehenden Files.
CDK-Guard verifiziert: npx cdk synth schlaegt fehl mit [McpReplicateHostedStack] upstreamTokens ARN enthaelt 'PLACEHOLDER' — bitte ersetzen vor cdk deploy. Setup-Anleitung: README.md §Deploy. Genau das gewuenschte Verhalten.
Phase-B-Backlog (separater PR nach AWS-Deploy)
| ID | Severity | Was |
|---|---|---|
| M11 | MED | main.py Split (830 Zeilen, 5+ Verantwortungen — kieran-Finding 2): middleware.py / subproc.py / tools.py / catalog.py |
| M12 | MED | Integration-Tests via Starlette TestClient (build_app + httpx-Probe gegen /health, Security-Headers, Middleware-Order) |
| M14 | MED | Pydantic-Models statt dict[str, Any]-Soup im Tool-Catalog + Layer-Returns |
| M13 | MED | getattr-Ketten in _extract_subject mit Protocol-Type + try/except statt 4-Ebenen-Defensive |
| M15 | MED | Test-Mocks: Test-Builder im Production-Code statt MagicMock-Internal-Coupling |
Phase-C-Backlog (irgendwann, Hardening + Hygiene)
| ID | Severity | Was |
|---|---|---|
| ADV-002 | MED | Route53 Synthetic-Probe + SNS-Alarm gegen https://replicate.agenticventures.de/health — Tunnel-Outage-Blindheit. Gilt fuer alle hosted MCPs — eigener PR fuer alle gleichzeitig (mcp-vf-hosted, mcp-whatsapp-hosted, mcp-replicate-hosted) |
| SEC-1 | MED | Subject=None → “anon” shared Rate-Bucket — Multi-Token-Bypass des Rate-Cap |
| ADV-003 | MED | Block-Audit-Log-Spam-Throttling — F2-Block kommt vor Rate-Limit → CloudWatch-Cost-Amp moeglich |
| MAINT-1 | MED | Sub-MCP-Map fuer EINEN Eintrag = premature abstraction → entkoppeln |
| MAINT-2 | MED | _build_proxy vs _build_sub_mcp_client Transport-Konstruktion DRY-Refactor |
| ADV-005 + SEC-2 | LOW | Audit-PII: Klarnamen-Schutz + source_ip + args-Fingerprint bei Bypass-Events |
| SEC-3 | LOW | _tool_args fail-closed bei Non-Dict (Future-Proofing FastMCP-Upgrade) |
| Brand-Lock-Idempotenz | LOW | 1-Liner — Doppel-Injection vermeiden |
| Slash-Prompts | LOW | leerer String nach _sanitize → User-Feedback statt Garbage-Prompt |
| Doku | LOW | README + docs/architecture.md Drift-Risk — Rate-Limit-Werte doppelt |
Lessons fuer naechste hosted-MCPs
Drei Pattern aus diesem Lauf die in das Tracker-File gehoeren:
- Catalog-Cache-Pattern (W4): Lazy-built Cache nur bei voll-success persistieren. Pattern-Vorbild jetzt: dieser Code. Soll in
mcp-vf-hostedretrofitted werden. - Drift-Test fuer Layer-Tool-Defaults (W5): wenn Layer-Tools die GuardMiddleware bypassen (per Design), MUSS ein Test pinnen dass ihre Defaults in der Whitelist sind. 1-Zeilen-Test.
- CDK-Pre-Synth-Guard fuer PLACEHOLDER (W6): in jedem CDK-Stack der von einem Pattern-Vorbild kopiert ist. Verhindert Mirror-Pattern-Propagation in Production.
Cross-Ref
- Vorlaeufer: report
- Build-Run: _index
- Tracker: mcp-audit-findings-cross-repo
- Pattern-Doku: mcp-hosting-fargate-tunnel
- Plan-Source: 2026-05-19-design-stack-julian