Skip to content

REST: Configure shared storage credential refresh endpoints - #17912

Open
zhangxinyao88 wants to merge 2 commits into
apache:mainfrom
zhangxinyao88:codex/issue-17810-resolve-refresh-endpoint
Open

zhangxinyao88 wants to merge 2 commits into
apache:mainfrom
zhangxinyao88:codex/issue-17810-resolve-refresh-endpoint

Conversation

@zhangxinyao88

@zhangxinyao88 zhangxinyao88 commented Sep 1, 2026 •

Copy link
Copy Markdown

Fixes #17810.

Scheduled storage credential refresh can fail when FileIO receives REST catalog properties without a resolved credentials URI. Resolve the table credentials endpoint in RESTSessionCatalog when vended credentials are present, and pass it through a shared rest.credentials.endpoint property. AWS and GCP prefer this endpoint and retain their legacy refresh properties as fallbacks.

Testing

  • Full TestRESTCatalog suite, including endpoint configuration with and without storage credentials.
  • AWS/GCP credential configuration, endpoint precedence, legacy compatibility, and consecutive scheduled refresh tests.
  • Formatting checks for core, AWS, and GCP.

AI Disclosure

  • Model: GPT-6
  • Platform/Tool: Codex
  • Human Oversight: unreviewed
  • Prompt Summary: Address review feedback by configuring a shared storage credential refresh endpoint in RESTSessionCatalog, retaining legacy compatibility, and adding regression coverage.

@github-actions github-actions Bot added the AWS label Sep 1, 2026
@zhangxinyao88
zhangxinyao88 marked this pull request as ready for review September 2, 2026 00:13

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks correct and minimal. It resolves the property that actually carries the server-supplied relative value against the operator-trusted catalog uri, mirroring the existing AwsClientProperties resolution exactly, with both putIfAbsent branches covered and no new credential-exposure surface. Thank you @zhangxinyao88, please ping the expert maintainers for further review!

@zhangxinyao88

Copy link
Copy Markdown
Author

The fix looks correct and minimal. It resolves the property that actually carries the server-supplied relative value against the operator-trusted catalog uri, mirroring the existing AwsClientProperties resolution exactly, with both putIfAbsent branches covered and no new credential-exposure surface. Thank you @zhangxinyao88, please ping the expert maintainers for further review!

Thanks @uros-b! @nastra, would you mind taking a look when you get a chance? This is a small fix around resolving the relative storage credential refresh endpoint in S3FileIO.

}

try (VendedCredentialsProvider provider = VendedCredentialsProvider.create(properties)) {
Map<String, String> refreshProperties = Maps.newHashMap(properties);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are doing this already in

this.refreshCredentialsEndpoint =
RESTUtil.resolveEndpoint(
properties.get(CatalogProperties.URI), properties.get(REFRESH_CREDENTIALS_ENDPOINT));

Why do we need to do it here again?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, thanks. AwsClientProperties handles the initial client setup, but the scheduled refresh creates VendedCredentialsProvider from the raw FileIO properties. I moved the resolution into the provider so both paths use it, and added a relative URI test in 9480069.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel like this is the right place to configure this. It seems like a better place is in the RESTSessionCatalog when we process the storage credentials and configure the FileIO. This isn't specific to S3FileIO, so finding the right place up the stack would make more sense.

Map<String, String> refreshProperties = Maps.newHashMap(properties);
refreshProperties.putIfAbsent(
VendedCredentialsProvider.URI,
RESTUtil.resolveEndpoint(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would have the same issue with GCSFileIO when its refreshStorageCredentials() is being called, right? Maybe we should fix both places then

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, GCS had the same gap. Its refresh path also uses raw properties, so I added the same resolution in OAuth2RefreshCredentialsHandler, with a regression test in 9480069.

@zhangxinyao88
zhangxinyao88 force-pushed the codex/issue-17810-resolve-refresh-endpoint branch from 4a2de0d to 9480069 Compare September 9, 2026 21:37
@github-actions github-actions Bot added the GCP label Sep 9, 2026
@zhangxinyao88 zhangxinyao88 changed the title AWS: Resolve relative storage credential refresh endpoint AWS/GCP: Resolve relative storage credential refresh endpoints Sep 9, 2026
@nastra
nastra requested a review from danielcweeks September 14, 2026 10:47
@zhangxinyao88
zhangxinyao88 force-pushed the codex/issue-17810-resolve-refresh-endpoint branch from 9480069 to a1caa75 Compare September 18, 2026 02:30
@zhangxinyao88

Copy link
Copy Markdown
Author

@nastra @danielcweeks, could one of you take a look and merge if everything looks good? Nastra has approved it, CI passes, and it merges cleanly with current main.

.build();
this.catalogEndpoint = properties.get(CatalogProperties.URI);
this.credentialsEndpoint = properties.get(URI);
this.credentialsEndpoint =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be unnecessary if we do the resolution in the RESTSessionCatalog during configuration of the File IO.

@danielcweeks

danielcweeks commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

@zhangxinyao88 It feels like this resolution logic is being pushed down too far. There's nothing specific to the FileIO and can be handled when the IO is constructed. We should also only configure the refresh if there are actually credentials (e.g. if using remote signing, we don't need the refresh path).

Looking a little closer, I now see that each of the FileIOs are using a different property to identify the refresh URI, which I don't think is the right way to handle this. There really should only be on property which resolves to the ../{table}/credentials endpoint.

I would recommend that we create a single property for the refresh endpoint and resolve it when we create the FileIO in the RESTSessionCatalog. That would then flow down to the FileIO and we can resolve to that property (we can deprecate the FileIO properties or fallback to those for backward compatibility). I think this messiness is largely due to how the refresh evolved.

Map<String, String> refreshProperties = Maps.newHashMap(properties);
refreshProperties.putIfAbsent(
VendedCredentialsProvider.URI,
properties.get(AwsClientProperties.REFRESH_CREDENTIALS_ENDPOINT));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is a cloud property specific field. It seems like this should be the same for all IO implementations.

Resolve the table credentials endpoint when constructing FileIO with vended credentials. AWS and GCP consume the shared endpoint and retain their existing configuration as a compatibility fallback.

Generated-by: Codex
@github-actions github-actions Bot added the core label Oct 7, 2026
@zhangxinyao88 zhangxinyao88 changed the title AWS/GCP: Resolve relative storage credential refresh endpoints REST: Configure shared storage credential refresh endpoints Oct 7, 2026
@zhangxinyao88

Copy link
Copy Markdown
Author

I would recommend that we create a single property for the refresh endpoint and resolve it when we create the FileIO in the RESTSessionCatalog.

Moved this into RESTSessionCatalog: it sets rest.credentials.endpoint only when storage credentials are present. AWS and GCP now use that endpoint, with the existing properties retained as fallbacks; tests cover both paths and the case without storage credentials.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] S3FileIO.refreshStorageCredentials() fails with "Invalid credentials endpoint: null" when using REST catalog with vended credentials

4 participants