Noizu.MCP.Auth.Server.CIMD.ReqFetcher (Noizu MCP v0.1.6)

Copy Markdown View Source

Default CIMD fetcher, over :req. Used automatically when :req is in your deps; pass cimd: [fetcher: ...] to substitute anything else.

Every limit Noizu.MCP.Auth.Server.SSRF.fetch_opts/0 names is enforced here, because a fetcher that quietly followed a redirect would undo the address check entirely:

  • redirect: false — a public URL that 302s to http://169.254.169.254/ is the whole game
  • max_body — a 64 KiB cap, checked against content-length and against what actually arrived, since content-length is a claim
  • timeout — 5 s connect and receive
  • Accept: application/json only

Summary

Functions

Fetch a client-id metadata document.

POST a form and decode the JSON response — the token exchange for Noizu.MCP.Auth.Server.Upstream.OIDC.

Functions

fetch(url, opts \\ [])

@spec fetch(
  String.t(),
  keyword()
) ::
  {:ok, %{status: pos_integer(), body: map(), headers: map()}}
  | {:not_modified, String.t() | nil}
  | {:error, term()}

Fetch a client-id metadata document.

{:ok, %{status:, body:, headers:}}, {:not_modified, etag} for a 304, or {:error, reason}.

post_form(url, body)

@spec post_form(String.t(), map()) :: {:ok, map()} | {:error, term()}

POST a form and decode the JSON response — the token exchange for Noizu.MCP.Auth.Server.Upstream.OIDC.