Security updates

Merged
H3
5mo ago
+2817-90

Summary by cubic

Post‑audit hardening for HTTP, GraphQL, and WebSocket to block SSRF and credential leaks. Tightens URL/loopback checks, secures redirects and OAuth2 token handling (incl. relative token URLs), patches GraphQL introspection, and hardens WebSocket message templating; adds tests and bumps versions.

  • Bug Fixes

    • Broaden loopback detection and replace prefix checks with hostname/IP validators: https:///wss:// allowed; http:///ws:// loopback only (covers 0.0.0.0, ::, full 127.0.0.0/8, IPv4‑mapped IPv6).
    • Harden redirects via safe_request_with_redirects: strip auth‑like headers, request body, and proxy creds on cross‑origin; normalize default ports for same‑origin; used for manual discovery, tool calls, OAuth2 across HTTP/SSE/WS.
    • Validate OAuth2 token_url at runtime and during OpenAPI conversion; resolve relative tokenUrl against spec_url and validate.
    • GraphQL: disable redirects before schema introspection so the first request is protected.
    • WebSocket: enforce “WSS or loopback” with hostname validators, remove invalid redirect flag, and escape JSON‑shaped string templates to prevent injection.
    • SSE: ensure ClientSession closes on success to prevent leaks.
  • Dependencies

    • Bump utcp-http to 1.1.6, utcp-gql to 1.1.3, utcp-websocket to 1.1.3.
    • Add aiohttp>=3.8 to utcp-gql.