Skip to content

fix(rest): prevent OAuth client secret redirection during refresh - #1138

Open
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:codex-security/arp_58d1a99827c52fa3a41aeaead8b257b3
Open

manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:codex-security/arp_58d1a99827c52fa3a41aeaead8b257b3

Conversation

@manuzhang

@manuzhang manuzhang commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Why

REST catalog initialization merges server-provided defaults and overrides into the client configuration. Previously, rest.auth.oauth2.trust-server-uri defaulted to true, allowing the server to select the OAuth token endpoint.

A server could override oauth2-server-uri, or change the catalog uri used to resolve a relative token endpoint. A subsequent token refresh could then send the client's retained OAuth client secret to a server-selected destination.

Trusting a catalog to provide metadata should not implicitly authorize it to choose where the client submits its credentials.

What changes

  • Default rest.auth.oauth2.trust-server-uri to false, requiring explicit client opt-in for server-selected OAuth endpoints.
  • When a nonempty credential is configured and server endpoint trust is disabled, require a client-provided oauth2-server-uri beginning with http:// or https:// before any I/O.
  • Preserve the client's endpoint trust policy after merging server configuration, and restore its OAuth endpoint for credential-bearing sessions. This prevents server overrides from redirecting later refresh requests containing the client secret.
  • Apply endpoint validation and pinning only when client credentials are nonempty, preserving token-only and unauthenticated catalog behavior.

With the new default, clients using credentials must configure an absolute OAuth token endpoint, for example:

oauth2-server-uri=https://auth.example/token

Clients that intentionally accept server-selected endpoints can explicitly configure:

rest.auth.oauth2.trust-server-uri=true

Validation

Regression tests cover:

  • Rejection of missing or invalid client endpoints before I/O.
  • Refresh requests submitting client_secret to the original client endpoint despite server overrides of the catalog URI, OAuth endpoint, and trust policy.
  • Continued support for server endpoint overrides when explicitly enabled.

The existing refresh-executor test now supplies an explicit token endpoint.

Server-provided catalog configuration could override the OAuth token endpoint or catalog base URI and redirect a retained client secret during token refresh.

Disable trust in server-selected OAuth endpoints by default. When client credentials are configured, require an explicit absolute HTTP(S) token endpoint before any I/O and preserve the client endpoint and trust policy after merging server configuration.

Keep server endpoint overrides available through explicit opt-in, preserve token-only and unauthenticated behavior, and update regression tests to verify the refresh destination and client-secret submission.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant