Subscribe to the Non-Human & AI Identity Journal

How should security teams implement exact redirect URI matching in OIDC and SAML?

Security teams should register only exact callback URLs, including scheme, host, path, and trailing slash, then reject any request that does not match the stored value. In SAML, the ACS URL and recipient checks should be equally strict. This prevents callback ambiguity and closes a common federation abuse path.

Why This Matters for Security Teams

Exact redirect uri matching is not a cosmetic hardening choice. In OIDC, an overly broad callback rule can let an attacker steer an authorization code to an unintended endpoint, especially when subpaths, wildcard hosts, or permissive normalization are allowed. In SAML, the same failure shows up as loose ACS or recipient checks that accept assertions outside the intended relying party path.

That matters because federation is often the last trust gate before an identity token or assertion becomes application access. The practical risk is not just login bypass, but token theft, account takeover, and cross-application session confusion. NIST’s NIST Cybersecurity Framework 2.0 emphasizes disciplined access control and monitoring, while NHIMG research on the Ultimate Guide to NHIs shows how often organisations still miss basic identity hygiene that makes these failures harder to detect.

In practice, many security teams only discover redirect abuse after an app team has already allowed a broader pattern for convenience, then inherited the risk through federation drift.

How It Works in Practice

The implementation rule is straightforward: compare the incoming redirect URI, ACS URL, or recipient value against the registered value as a full string match after applying only the minimum normalization required by the protocol. That means scheme, host, port if present, path, and trailing slash must all align exactly. If the application supports multiple legitimate callback endpoints, each one should be explicitly registered rather than generalized through patterns.

For OIDC, the authorization server should reject any authorization request whose redirect URI does not exactly match a pre-registered value. For SAML, the identity provider and service provider should verify the Assertion Consumer Service endpoint and recipient conditions with the same strictness. This is not just an input validation issue. It is an authorization boundary, because the redirect target determines where credentials or assertions can land.

Teams should also pair exact matching with operational controls:

  • Keep a minimal allowlist of callback URLs per application environment.
  • Register development, staging, and production endpoints separately.
  • Forbid wildcard domains and path prefixes unless the protocol profile explicitly requires them.
  • Review any normalization logic for case handling, punycode, percent encoding, and trailing slashes.
  • Log and alert on rejected callback attempts so misconfigurations are visible early.

NHIMG’s Hugging Face Spaces breach is a useful reminder that identity trust failures often become security incidents when assumptions about where tokens or secrets can be sent are too loose. These controls tend to break down in large SaaS estates with many tenant-specific subdomains because callback sprawl makes exact registration difficult to govern consistently.

Common Variations and Edge Cases

Tighter redirect controls often increase deployment overhead, requiring organisations to balance security against application agility. That tradeoff is real, especially when teams rely on dynamic tenant onboarding, white-labeled domains, or partner-facing SSO flows.

There is no universal standard for every edge case, so current guidance suggests treating exceptions as explicit design decisions rather than implicit pattern matching. A few scenarios deserve special attention:

  • Mobile and native apps may use loopback or custom scheme redirects, but the accepted endpoint still needs exact registration and strict validation.

  • Multi-tenant platforms sometimes need one callback per tenant, yet broad wildcards should be avoided unless a control owner has documented the residual risk.

  • URL normalization can create surprises, such as treating encoded characters, mixed case paths, or omitted trailing slashes as equivalent when the security policy should not.

  • In SAML, assertion recipient checks and destination checks should not be relaxed simply because the ACS URL is behind a load balancer or reverse proxy.

Practitioners should also review whether federation libraries silently fall back to the first registered redirect URI or accept partial matches when the request parameter is missing. That behaviour should be considered a defect unless the protocol profile and application design clearly justify it. Exact matching is most reliable when identity teams own the registration process and application teams cannot mutate callback values at runtime.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Non-Human Identity Top 10 NHI-02 Exact callback validation limits token leakage from misdirected NHI federation flows.
OWASP Agentic AI Top 10 A-07 Redirect abuse is a common trust-boundary failure in automated auth flows.
NIST CSF 2.0 PR.AC-1 Authenticated access paths must be tightly controlled to prevent callback abuse.

Map redirect URI allowlists to access control requirements and monitor rejected federation requests.