Skip to content

feat(rest): add opt-in client-only-properties to protect oauth2-serve… - #1041

Open
lishuxu wants to merge 2 commits into
apache:mainfrom
lishuxu:feat/rest-client-only-properties
Open

lishuxu wants to merge 2 commits into
apache:mainfrom
lishuxu:feat/rest-client-only-properties

Conversation

@lishuxu

@lishuxu lishuxu commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

…r-uri

Introduce rest.client-only-properties, an opt-in mechanism that lets clients prevent server-provided defaults/overrides from affecting specified configuration keys. Keys listed in this property are resolved from client configuration only.

When oauth2-server-uri appears in the list:

  • Server-provided values for it are ignored during config merge
  • The endpoint is resolved to an absolute URL using the client's uri before merging, preventing indirect override via uri changes
  • InitSession and CatalogSession now use consistent endpoints

This addresses the risk of OAuth2 credentials being sent to an unintended endpoint when a REST catalog server overrides oauth2-server-uri or uri. The protection is opt-in to maintain backward compatibility and align with REST spec defaults.

Changes:

  • Add RestCatalogProperties::kClientOnlyProperties
  • Export auth::ResolveOAuth2ServerUri for reuse
  • Add MergeServerConfig() and ParseClientOnlyProperties() in rest_util
  • Replace MergeConfigs with MergeServerConfig in RestCatalog::Make
  • Warn when oauth2-server-uri is neither explicit nor protected while using credential auth (following Java's warnIfOAuthServerUriNotSet)
  • Add unit tests covering direct/indirect override scenarios

Default behavior unchanged: without setting rest.client-only-properties, server overrides apply as before, consistent with Java and Rust clients.

shuxu.li and others added 2 commits October 19, 2026 14:43
…r-uri

Introduce rest.client-only-properties, an opt-in mechanism that lets
clients prevent server-provided defaults/overrides from affecting
specified configuration keys. Keys listed in this property are resolved
from client configuration only.

When oauth2-server-uri appears in the list:
- Server-provided values for it are ignored during config merge
- The endpoint is resolved to an absolute URL using the client's uri
  before merging, preventing indirect override via uri changes
- InitSession and CatalogSession now use consistent endpoints

This addresses the risk of OAuth2 credentials being sent to an
unintended endpoint when a REST catalog server overrides
oauth2-server-uri or uri. The protection is opt-in to maintain
backward compatibility and align with REST spec defaults.

Changes:
- Add RestCatalogProperties::kClientOnlyProperties
- Export auth::ResolveOAuth2ServerUri for reuse
- Add MergeServerConfig() and ParseClientOnlyProperties() in rest_util
- Replace MergeConfigs with MergeServerConfig in RestCatalog::Make
- Warn when oauth2-server-uri is neither explicit nor protected while
  using credential auth (following Java's warnIfOAuthServerUriNotSet)
- Add unit tests covering direct/indirect override scenarios

Default behavior unchanged: without setting rest.client-only-properties,
server overrides apply as before, consistent with Java and Rust clients.

Co-Authored-By: Claude <noreply@anthropic.com>
- Construct string_view from an iterator pair; MSVC string_view
  iterators are not pointers.
- Parenthesize std::min in StringUtils so the Windows min() macro pulled
  in through cpr does not expand there.

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