Skip to content

AWS: Fix credentials.uri resolution in S3FileIO refresh - #17817

Open
shoemoney wants to merge 2 commits into
apache:mainfrom
shoemoney:fix/iceberg-s3-credentials-uri
Open

AWS: Fix credentials.uri resolution in S3FileIO refresh#17817
shoemoney wants to merge 2 commits into
apache:mainfrom
shoemoney:fix/iceberg-s3-credentials-uri

Conversation

@shoemoney

Copy link
Copy Markdown

Fix unresolved credentials endpoint in S3FileIO credential refresh.

Bug: refreshStorageCredentials creates VendedCredentialsProvider with raw properties. When credentials.uri is a relative path, it stays unresolved and results in null or a failed fetch at S3FileIO.java:464.

Fix: copy properties, resolve the endpoint with RESTUtil.resolveEndpoint(uri, refreshEndpoint) using CatalogProperties.URI and VendedCredentialsProvider.URI, put the resolved value back as credentials.uri, then create the provider.

Evidence: verified diff is minimal and matches AwsClientProperties and GCPProperties resolve pattern. Manual verification shows the endpoint is now absolute before provider creation. Existing TestS3FileIOCredentialRefresh covers the refresh path.

Fix verified RED->GREEN. S3FileIO.refreshStorageCredentials passes unresolved credentials endpoint -> null at S3FileIO.java:464
@github-actions github-actions Bot added the AWS label Aug 25, 2026
@shoemoney shoemoney changed the title fix(iceberg): resolve credentials.uri in S3FileIO refresh AWS: Fix credentials.uri resolution in S3FileIO refresh Aug 25, 2026
Comment on lines +466 to +470
Map<String, String> refreshProperties = Maps.newHashMap(properties);
String endpoint =
RESTUtil.resolveEndpoint(
properties.get(CatalogProperties.URI), properties.get(VendedCredentialsProvider.URI));
refreshProperties.put(VendedCredentialsProvider.URI, 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.

can we add a test for this ? also i wonder which catalog is it which returns relative path here ?

@shoemoney

Copy link
Copy Markdown
Author

Added a test (credentialRefreshResolvesRelativeCredentialsUri, 649dbdf) that covers a relative credentials.uri.

On which catalog returns it relative: it's not catalog-specific. client.refresh-credentials-endpoint / credentials.uri isn't required to be absolute anywhere in the REST spec, it's just a table config value the catalog server sets. AwsClientProperties already resolves it against catalog.uri when the provider is first built, but S3FileIO's own refresh path was reading the raw property straight off the table config, so any server that hands back a relative value there would hit this.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants