Skip to content

agent-oauth: use SSRF-safe fetch across discovery and token flows #5960

Description

@bokelley

Problem

The Agent OAuth route performs synchronous URL validation, but its MCP/@adcp SDK discovery, dynamic registration, and token requests still default to global fetch. A public hostname can therefore pass preflight and rebind to a loopback/private address at dial time; redirects to private literals are also unsafe without per-hop validation.

This is an authenticated blind-SSRF reachable from org-managed agent contexts.

Acceptance criteria

  • Inject a scoped SSRF-safe fetch into PRM discovery, authorization-server discovery, OAuth start/DCR, callback/token exchange, and status discovery.
  • Support the SDK request shapes actually used: GET discovery plus JSON and URL-encoded POST bodies.
  • Preserve abort signals and required headers.
  • Validate every redirect hop and enforce connect-time DNS pinning using the existing safeFetch primitive.
  • Tests prove fetch injection across each route flow and adapter request normalization.

Medium/P1 follow-up from Argus review of #5958. Keep trailing-dot hostname normalization separate in #5959.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addieIssues related to Addie (via any channel)bugSomething isn't workingclaude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.priority:P1High priority: important bug or follow-up, not immediate P0

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions