security fix

Merged
H3
6mo ago
+909-22

Summary by cubic

Post-audit hardening across @utcp/http: tighter redirect handling with stronger credential scrubbing, expanded loopback detection, and safer OAuth2 token URL validation. SSE and streaming handshakes now refuse redirects.

  • Bug Fixes

    • Added safeRequestWithRedirects for manual discovery, tool calls, and OAuth2 token fetches.
    • Hardened cross-origin redirects: strip auth/API-key/cookie headers (plus a regex catch‑all), drop the request body on cross-origin 307/308, and normalize default ports so https://x and https://x:443 are same-origin.
    • Validated OAuth2 token_url at runtime and in OpenApiConverter; eager checks resolve relative tokenUrl against specUrl and reject plain HTTP and internal/metadata hosts.
    • Expanded isLoopbackUrl to include 0.0.0.0, ::, the full 127.0.0.0/8 range, and IPv4‑mapped IPv6.
  • Dependencies

    • Bumped @utcp/http to 1.1.6.