AttestoPhoenix.ClientIdMetadata.Logo (AttestoPhoenix v5.0.0)

Copy Markdown View Source

SSRF-guarded logo_uri prefetch and image validation (draft-ietf-oauth-client-id-metadata-document-03 §10.9).

Authorization servers that wish to display a CIMD client's logo_uri to an end-user MUST prefetch the image and serve it from a trusted origin rather than linking directly to the client's logo_uri, and MUST verify that the downloaded bytes are a valid image.

Supports raster formats (image/png, image/jpeg, image/gif, image/webp), verifying both the HTTP Content-Type header and the leading magic bytes of the fetched payload under HostPolicy, FlowControl, and Fetcher.Req's SSRF guard and byte cap. SVG is intentionally excluded by default to avoid active script/entity risks when re-served.

Summary

Functions

Prefetch and validate the logo_uri from a CIMD client map, %Client{}, or URL string.

Types

logo_result()

@type logo_result() :: %{
  body: binary(),
  content_type: String.t(),
  cache_control: keyword()
}

Functions

prefetch(client, config, opts)

@spec prefetch(
  String.t() | map() | AttestoPhoenix.ClientIdMetadata.Client.t(),
  AttestoPhoenix.Config.t(),
  keyword()
) :: {:ok, logo_result()} | {:error, term()}

Prefetch and validate the logo_uri from a CIMD client map, %Client{}, or URL string.