Skip to content

Make discovery grant and response types configurable #924

Open

Description

@ryanio

Preflight checklist

  • I could not find a solution in the existing issues, docs, or discussions.
  • I have joined the ZITADEL chat.

Describe the problem

pkg/op/discovery.go currently hardcodes these authorization server capabilities:

  • ResponseTypes always returns code, id_token, and id_token token.
  • GrantTypes always starts with authorization_code and implicit.

A self-hosted deployment can disable implicit and ID-token authorization responses on every registered client, but its discovery document still advertises them. There is no provider configuration that removes those capabilities globally.

This is not a client authorization bypass. Clients that only allow code correctly reject response_type=id_token and response_type=id_token token with unauthorized_client. The problem is that the server metadata overstates the deployment policy, and operators cannot publish code-only metadata without maintaining a fork or rewriting the discovery response at a reverse proxy.

OAuth 2.0 Security Best Current Practice recommends authorization code instead of responses that issue tokens from the authorization endpoint. Some security reviews also require discovery metadata to match the enabled deployment policy.

Relevant code:

Describe your ideal solution

Add provider configuration for server-wide supported response types and grant types, with current behavior as the backwards-compatible default.

When configured as code-only:

  1. Discovery returns response_types_supported: ["code"] and does not advertise implicit.
  2. Authorization requests using id_token or id_token token are rejected at the provider level, even if a client is accidentally configured to allow them.
  3. The same configuration drives metadata and request validation so they cannot drift.
  4. Existing deployments that do not set the new options retain the current defaults.

A possible API would add SupportedResponseTypes and SupportedGrantTypes to provider configuration, then have both discovery generation and authorization request validation consume them.

Version

Observed with github.com/zitadel/oidc/v3 v3.47.5 in current ZITADEL main. The hardcoded behavior is also present on the current zitadel/oidc main branch.

Environment

Self-hosted

Additional context

We currently enforce code-only behavior per client and have live negative tests for both ID-token response types. Configurable server-wide enforcement would remove the need for a discovery rewrite at the edge and protect against future client misconfiguration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions