Skip to content
Wallet and Entity Collection draft updates
Documentation menu

11.3. Bound discovery and control outbound requests

Feature guides / 11. Operating a federation application · Example context

LIGO Wiki follows authority_hints supplied by other entities. Its operator needs predictable request counts and an outbound-network policy, especially when the application runs beside private infrastructure.

How to use it

Set the shared transport options on the host or protocol role. The host's discovery operation then applies those limits across traversal and validation. Pass request-specific cancellation on the call rather than retaining a cancelled signal in a long-lived host. Inject an HttpClient when the platform requires controlled fetch behavior and preserve its supplied RequestInit. Security considerations.

import { Leaf } from "@oidfed/leaf";
import { entityId, type CryptoContext, type HttpClient, type TrustAnchorSet } from "@oidfed/core";

export async function boundedLigoWiki(
  crypto: CryptoContext, trustAnchors: TrustAnchorSet, httpClient: HttpClient,
) {
  const ligoWiki = await Leaf.create({
    entityId: "https://wiki.ligo.example", authorityHints: ["https://incommon.example"],
    crypto, trustAnchors, metadata: { federation_entity: {} },
    options: {
      httpClient, allowedHosts: ["op.umu.example", "umu.example", "swamid.example", "incommon.example", "edugain.example"],
      httpTimeoutMs: 5000, maxTotalFetches: 12, maxConcurrentFetches: 3,
      maxResolutionSteps: 40, maxResponseBytes: 256 * 1024,
    },
  });
  return {
    ligoWiki,
    discoverUmeaOp: (signal: AbortSignal) => ligoWiki.discoverEntity(
      entityId("https://op.umu.example"), { signal },
    ),
  };
}

What your application owns

Choose limits for the federation graph you support and handle incomplete discovery explicitly. Restrict egress and resolved addresses at the network boundary as well as using URL checks; a runtime-agnostic library cannot control every platform's DNS or socket behavior. Do not override cancellation or retry integrity failures as ordinary outages. Record safe operational outcomes without logging JWTs or private keys.

Bound the whole operation

A chain discovery can contact several authorities and later resolve accreditation issuers. Configure an operation budget that reflects the complete graph work, not only one HTTP request. The shared fetch budget covers discovery and candidate validation; a topology that needs more work must receive an explicit larger budget.

Restrict outbound destinations in the host transport, set response and timeout limits, and propagate cancellation from the incoming operation. Cancellation releases the caller; it does not necessarily undo a storage transaction or signing operation already owned by another component. Retry only after deciding whether the failure is temporary and whether another attempt fits the host's resource policy.

Endpoint access and network policy

§8.8 lets a federation require, allow, or omit client authentication at federation endpoints. Its private_key_jwt assertions MUST use Federation Entity Keys and the receiver's Entity Identifier as audience. Authenticated requests MUST use POST. The operator selects per-endpoint *_auth_methods under §8.8.1; the default is ["none"].

The specification also permits other authentication methods. oidfed's authority middleware supports none and private_key_jwt directly, plus host verifiers registered through endpointAuthentication.methods. Advertised methods without an implementation fail construction. Configure storage.replay when using private_key_jwt. Other integrations configure their own stores under the replay contract.

For outgoing requests across several entities, use getEndpointAuthentication to select credentials per endpoint and responder. Restrict credentials to endpoints your application has approved; a discovered endpoint and the supplied responder identifier are request context, not proof that it is safe to send credentials there. Returning undefined permits anonymous access explicitly. Callback errors stop the request. See credentials for each authority.

Entity Configuration discovery MUST use GET under §9.1. §9 sets publication requirements and Leaf exceptions. oidfed serves discovery without a Federation client assertion. The authentication metadata in §8.8.1 covers the endpoints named in §5.1.1; it does not configure discovery access controls. See the HTTP discovery contract.

Your application serves the HTTPS endpoints required by §5.1.1 and §9. §18.1 describes HTTP propagation attacks and the need for defenses. Core provides URL checks and bounded reads under its HTTP contract. DNS resolution and redirect handling also depend on the injected transport. Choose outbound access controls for your deployment; §18.1 does not mandate a particular network-filtering algorithm.

The operator sets framework eligibility rules. Available mechanisms include the metadata policies permitted by §6.1 and the Trust Mark issuer/owner declarations defined in §3.1.2. §17.5 separates validating a mark from deciding whether to use it. oidfed applies configured policies and verifies evidence; the framework defines acceptance criteria. Application-specific metadata value types SHOULD be checked after resolution under §6.1.

Applications choose which verified marks an entity must hold under §17.5. Use core's checkTrustMarkRequirements() with requiredTypes, or requireAllPublished for an all-published policy. Chain validity alone establishes no required accreditation. Revalidate evidence and check active status at the points required by your framework; §8.3 requires Resolve responses to include only verified marks whose active status has been checked.

Fetch statements and enforce transport policy

Fetch Entity Configurations and Subordinate Statements over HTTPS. The URL checks reject special-use IP literals and support host allowlists and additional blocked IPv4 ranges. DNS resolution and redirect policy belong to the HTTP transport: configure your injected httpClient and network access controls for the deployment. HTTP media-type names are compared case-insensitively. JSON responses accept parameters such as charset=utf-8 (RFC 8259 §11); registered Federation types, including application/trust-chain+json, require no parameters under §15. Entity Configuration discovery uses GET under §9.1, without a Federation client assertion. The advertised *_auth_methods settings cover other federation endpoints. Profile-specific discovery access controls require a suitably configured HTTP transport.

The host and role methods apply this retrieval policy internally. For an inspection tool that specifically needs an unvalidated EC JWT, core exposes fetchEntityConfiguration(); fetching it is not an alternative to the validated discovery above.

import type { CryptoEngine } from "@oidfed/crypto";
import { fetchEntityConfiguration, entityId } from "@oidfed/core";

export async function fetchLeafConfiguration(engine: CryptoEngine) {
  const target = entityId("https://leaf.example.com");

  // Fetch the self-signed Entity Configuration from its well-known endpoint
  const ecResult = await fetchEntityConfiguration(target, {
    engine,
    httpTimeoutMs: 5000,
    clockSkewSeconds: 60
  });

  if (ecResult.ok) {
    console.log("Entity Configuration retrieved; validate it before use");
  }
  return ecResult;
}

EC and Subordinate Statement caches expire at the earlier of the statement's exp and cacheMaxTtlSeconds (3600 seconds by default). Fetchers discard stale cache entries and refetch, following Federation §10.2. Decoding exp determines cache lifetime only; callers still verify the returned JWT. A fetched statement without a usable future expiry is returned for validation and left uncached. Malformed fetch endpoint URLs return an error Result.

The HTTP method helpers return 405 with Allow and the method_not_allowed extension code. Their JSON body includes error_description, following the error format in §8.9.

maxTotalFetches counts calls to the configured HTTP client. Redirects followed inside that client can make additional network exchanges. Deployments needing a limit on every exchange should enforce it in their HTTP client; endpoints that reject redirects retain that restriction.

Next: 11.4. Report diagnostics and handle failures explicitly

View source on GitHub