Skip to content

Fix Iceberg vended credentials not working with REST catalogs that return credentials via storage-credentials instead of config.#28290

Open
rcjverhoef wants to merge 1 commit intotrinodb:masterfrom
rcjverhoef:rcjverhoef/salvador
Open

Fix Iceberg vended credentials not working with REST catalogs that return credentials via storage-credentials instead of config.#28290
rcjverhoef wants to merge 1 commit intotrinodb:masterfrom
rcjverhoef:rcjverhoef/salvador

Conversation

@rcjverhoef
Copy link

Description

Iceberg Credential Vending doesn't work with REST catalogs following latests specs, specifically catalogs that don't provide the config fallback. Per latest spec:

Clients must first check whether the respective credentials exist in the storage-credentials field before checking the config for credentials.

Additional context and related issues

The Iceberg REST spec defines two mechanisms for credential vending:

  • config map (older): credentials are returned as key-value pairs in the config field of LoadTableResponse. Trino already supports this.
  • storage-credentials array (newer, preferred): credentials are returned as typed Credential objects with a prefix and config. Trino did not support this.

When Trino provides a custom ioBuilder to RESTSessionCatalog (which it always does), storage-credentials are dropped in RESTSessionCatalog.newFileIO() — only the config map is passed through. Without a custom ioBuilder, Iceberg handles this via the SupportsStorageCredentials interface, but that path is never taken in Trino.

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x ) Release notes are required, with the following suggested text:

Iceberg connector

  • Fix vended credentials not working with REST catalogs that return credentials via storage-credentials instead of config.
## Section
* Fix some things. ({issue}`issuenumber`)

When the Iceberg REST catalog returns vended credentials via the
storage-credentials field (REST spec v2) instead of the config map,
Trino's custom ioBuilder causes RESTSessionCatalog to silently drop
them. This results in 403 errors when writing to storage.

Add StorageCredentialsMergingRestClient, a RESTClient wrapper that
intercepts LoadTableResponse and merges the best-matching storage
credential (by longest prefix) into the config map before Iceberg
processes it. This makes vended credentials flow through the existing
ioBuilder and IcebergRestCatalogFileSystemFactory without changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cla-bot
Copy link

cla-bot bot commented Feb 13, 2026

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@@ -0,0 +1,170 @@
/*
Copy link
Member

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 case to demonstrate #27416?

.withHeaders(RESTUtil.configHeaders(config))
.build(),
config -> {
var client = HTTPClient.builder(config)
Copy link
Member

Choose a reason for hiding this comment

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

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

Labels

iceberg Iceberg connector

Development

Successfully merging this pull request may close these issues.

2 participants

Comments