|
Option C Tools
|
Classes | |
| class | TestGateway |
| class | TestInputValidation |
| class | TestPolicyHardening |
| class | TestSandboxHardening |
| class | TestRedactionHardening |
| class | TestAuditHardening |
| class | TestGeneralHardening |
Functions | |
| McpMetrics | _isolated_metrics () |
| tuple[ServerState, McpAuditLogger] | _make_state (Path tmp_path, str sandbox_output='{"exit_code":0}', int sandbox_exit_code=0, str profile="default", bool safe_mode=False, int rate_limit=30) |
| dict | _last_audit (McpAuditLogger logger) |
Purpose
-------
Phase 5C programmatic sign-off of blueprint section 12 hardening
checklist.
Responsibilities
----------------
- Verify gateway controls (rate limit, tool manifest).
- Verify input validation (extra="forbid", path traversal, shell
metacharacters).
- Verify policy enforcement (write-tool confirm, oct_format double-guard,
strict profile).
- Verify sandbox constraints (no shell=True, cwd pinning, env
sanitisation, timeout, output cap).
- Verify redaction (secrets, project path, truncation).
- Verify audit records (JSONL per call, session/request IDs).
Diagnostics
-----------
Domain: MCP-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- Tests use mock sandbox and ``tmp_path``; no real subprocess is
spawned.
|
protected |
McpMetrics on a private CollectorRegistry — avoids ``Duplicated timeseries`` collisions across tests.
Definition at line 63 of file test_mcp_hardening.py.
|
protected |
|
protected |
Definition at line 72 of file test_mcp_hardening.py.