The :outbound option: deliberate exceptions to the rules this library
applies to every address it connects to.
By default an issuer, and every endpoint its metadata names, must be an
https URL whose host resolves only to public addresses. Requests are sent
to the address that was checked, and redirects are never followed, so there
is no second hop to screen. Two exceptions can be named, and both are exact:
outbound: [allowed_cidrs: ["10.20.0.0/16"]]
outbound: [allow_loopback_http: true]AttestoClient.AuthorizationCode.start/2, callback/3 and exchange/2,
AttestoClient.IDToken.verify/2, AttestoClient.Token.refresh/4,
AttestoClient.Logout.url/1, AttestoClient.Discovery.fetch/2,
AttestoClient.Discovery.fetch_jwks/2, and
AttestoClient.Issuer (and so AttestoClient.ResourceServer) take the
option, and so do the other calls that talk to an issuer or to an endpoint
the caller chose from its metadata: AttestoClient.UserInfo.verify/2,
AttestoClient.SignedIntrospection.verify/2,
AttestoClient.Token.exchange_pre_authorized_code/2 and revoke/2,
AttestoClient.WalletAttestation.fetch_challenge/2 and
AttestoClient.Wallet.request_credential/3.
AttestoClient.Discovery.fetch_resource/2 accepts :outbound for the
resource's own well-known URL. A challenge-selected :metadata_url and an
unpinned authorization server normally refuse it. The narrow exception is
allow_loopback_http: true for a loopback resource and loopback metadata
pointer; CIDR widening still requires the caller to pin the issuer and is
never applied to a challenge-selected URL.
Calls that connect to an address written by another party refuse :outbound
with {:error, :outbound_not_supported}:
AttestoClient.Wallet.CredentialOffer.fetch/2,
AttestoClient.Wallet.PresentationRequest.fetch/3 and from_uri/3, and
AttestoClient.Wallet.Presentation.submit/3 and present/3. The address each of them
connects to is written by another party (a credential offer link, a
verifier's request), not chosen by the operator, so an allowance there
would let whoever wrote the link direct a request into the listed networks.
It is never stored in an authorization transaction or a token set:
each call applies only what that call was given, so nothing a transaction
carries can widen what callback/3 connects to. Pass the same value to every
call that talks to the issuer.
:allowed_cidrs
A list of CIDR blocks naming the non-public networks the issuer's hosts may
resolve into, for an identity provider reachable only at a private address
(a cluster-internal name, split-horizon DNS). Every address a host resolves
to must be public or inside one of the blocks; anything else is refused with
:blocked_host, as before. https is still required.
This is an SSRF exception the operator takes on deliberately. With it, a
metadata document served by the issuer can direct this library's requests,
including the token request with its client credentials, at any host in the
listed networks. List the smallest blocks that contain the issuer. There is
no host-name form: allowing a name would trust DNS, and whoever controls the
name's answer could point it at any private address. The rule itself is
Attesto.OutboundTarget's; a block with host bits set, a malformed block and
a zero-length prefix are refused.
:allow_loopback_http
For development against an identity provider on the local machine. With
true, http is accepted for the issuer and for the endpoints in its
metadata when the host is localhost or a literal loopback address
(127.0.0.0/8, ::1), and such a host may be connected to. Every other host
still needs https and a public (or listed) address.
The option is refused, with {:error, :invalid_outbound}, when the issuer
itself is not a loopback host: it has no use against a deployed issuer, and
leaving it on there would let that issuer's metadata name a service on the
machine running this library. Do not set it outside development.
Summary
Functions
Check the :outbound value in opts.
Types
Functions
@spec validate(keyword()) :: :ok | {:error, :invalid_outbound}
Check the :outbound value in opts.
Returns :ok when it is absent, nil, or a keyword list holding only
:allowed_cidrs (a list of CIDR strings core accepts) and
:allow_loopback_http (a boolean), each at most once. Anything else is
{:error, :invalid_outbound}.