Repository navigation
REST: Configure shared storage credential refresh endpoints - #17912
zhangxinyao88 wants to merge 2 commits into
Conversation
uros-b
left a comment
There was a problem hiding this comment.
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 |
| } | ||
|
|
||
| try (VendedCredentialsProvider provider = VendedCredentialsProvider.create(properties)) { | ||
| Map<String, String> refreshProperties = Maps.newHashMap(properties); |
There was a problem hiding this comment.
we are doing this already in
iceberg/aws/src/main/java/org/apache/iceberg/aws/AwsClientProperties.java
Lines 120 to 122 in 48da548
Why do we need to do it here again?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
I guess we would have the same issue with GCSFileIO when its refreshStorageCredentials() is being called, right? Maybe we should fix both places then
There was a problem hiding this comment.
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.
4a2de0d to
9480069
Compare
Generated-by: Codex
9480069 to
a1caa75
Compare
|
@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 = |
There was a problem hiding this comment.
I think this would be unnecessary if we do the resolution in the RESTSessionCatalog during configuration of the File IO.
|
@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 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)); |
There was a problem hiding this comment.
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
|
Moved this into |
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
RESTSessionCatalogwhen vended credentials are present, and pass it through a sharedrest.credentials.endpointproperty. AWS and GCP prefer this endpoint and retain their legacy refresh properties as fallbacks.Testing
TestRESTCatalogsuite, including endpoint configuration with and without storage credentials.AI Disclosure