feat: close 4 more audit findings (SEC-005, SDK-002, OBS-006, SCALE-002/003)#11
Merged
Conversation
Closes the last code-fixable HIGH finding and provides the scaling artifact. - SEC-005 (high, partial->pass): DNS-pinned HTTP transport (_PinnedNetworkBackend via httpcore network_backend). Host is resolved exactly once, the resolved IP is validated against the SSRF blocklist and the TCP connection is pinned to it, while TLS SNI + certificate verification still use the original hostname (eliminates the resolve/connect TOCTOU). Verified end-to-end against a real host (live test). - SCALE-002/003: deploy/haproxy.cfg reference sticky-session config (Mcp-Session-Id stick-table + explicit session TTL) for the horizontal- scaling path; documented in docs/SECURITY.md. Egress guard split: _assert_safe_url (scheme + host allow-list, no DNS) + _resolve_and_validate (single resolution + IP blocklist + pinned IP). Re-audit record: pass 36->37, partial 8->7, 0 fail. 56 unit tests (+4), ruff clean, wheel builds. https://claude.ai/code/session_01CokY47qCb5iHuAfAEWdCvU
# Conflicts: # pyproject.toml
…(OBS-006) SDK-002 (medium, partial->pass): all 6 tools now declare typed Pydantic output schemas and return a hybrid CallToolResult carrying BOTH the curated Markdown/JSON in content AND a validated structuredContent envelope. Machine consumers get a real output schema with no loss of the human-readable UX. New models: BaseEnvelope, SLSucheEnvelope/SLTreffer, GGSLEnvelope, MiGeLEnvelope, GesuchseingaengeEnvelope, RechtskontextEnvelope/Gesetz, ServerInfoEnvelope; helper _structured_result(). OBS-006 (medium, partial->pass): MCP_OTEL_ENABLED now defaults on; _init_otel is a silent no-op when the [otel] extra is absent, so base installs and stdout (OBS-004) are unaffected. Verified TracerProvider + OTLP + span creation with the extra installed. Tests updated to read content/structuredContent (helpers _text/_struct); added otel-toggle + structured-content assertions. 57 unit tests, ruff clean, wheel builds. Re-audit: pass 37->39, partial 7->5, 0 fail. https://claude.ai/code/session_01CokY47qCb5iHuAfAEWdCvU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes every remaining audit finding that is fixable without a product/scope change. Re-audit: 39 pass / 5 partial / 0 fail (from 37/7/0; high findings 3→2, medium 4→2).
What changed
_PinnedNetworkBackendvia httpcore): host resolved exactly once, IP validated + pinned for the TCP connection, TLS SNI/cert still verified against the hostname (kills the resolve/connect TOCTOU). Verified end-to-end against a real host.CallToolResultwith both the curated Markdown/JSON (content) and a validatedstructuredContentenvelope — machine-readable, no UX loss.MCP_OTEL_ENABLED=0to disable); silent no-op when the[otel]extra is absent, so base installs and stdout (OBS-004) are unaffected. Verified TracerProvider + OTLP + span creation.deploy/haproxy.cfg— reference sticky-session config (Mcp-Session-Idstick-table + TTL) for the horizontal-scaling path.Verification
www.fedlex.admin.chresolves once, dials the pinned IP, TLS validates against the hostname.structuredContentvalidated, Markdown preserved).[otel]extra installed; clean stdout on import.main(dependabot bumps) — conflict resolved.Remaining (5) — each a deliberate decision, not a bug
These stand as documented accepted-risk / deferred. The v0.2.0 release is ready whenever you want it.
https://claude.ai/code/session_01CokY47qCb5iHuAfAEWdCvU