Skip to content

Conversation

smaheshwar-pltr
Copy link

@smaheshwar-pltr smaheshwar-pltr commented Oct 12, 2025

Description

// Work in progress

Support Azure credential vending with Iceberg REST catalog.

Additional context and related issues

Closes #23238

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.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

Summary by Sourcery

Enable Azure credential vending by extracting SAS tokens from file IO properties for Iceberg REST catalog and injecting them into the Azure filesystem via a new AzureVendedAuth wrapper.

New Features:

  • Support Azure SAS token vending in Iceberg REST catalog filesystem factory
  • Introduce AzureVendedAuth in AzureFileSystemFactory to apply per-account vended SAS tokens with fallback to default authentication

Copy link

cla-bot bot commented Oct 12, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Sreesh Maheshwar.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

Copy link

sourcery-ai bot commented Oct 12, 2025

Reviewer's Guide

This PR extends Iceberg REST catalog support to vend Azure SAS token credentials alongside existing S3 credential vending by unifying the credential selection logic, propagating vended credentials through the Azure filesystem, and introducing a new AzureVendedAuth implementation.

Class diagram for updated Azure authentication classes

classDiagram
    class AzureAuth {
        <<interface>>
        +void setAuth(String storageAccount, BlobContainerClientBuilder builder)
        +void setAuth(String storageAccount, DataLakeServiceClientBuilder builder)
    }
    class AzureAuthAccessKey
    class AzureAuthDefault
    class AzureAuthOauth
    class AzureVendedAuth {
        +Map<String, String> accountSasTokens
        +AzureAuth fallbackAuth
        +AzureVendedAuth(Map<String, String> accountSasTokens, AzureAuth fallbackAuth)
        +void setAuth(String storageAccount, BlobContainerClientBuilder builder)
        +void setAuth(String storageAccount, DataLakeServiceClientBuilder builder)
    }
    AzureAuth <|.. AzureAuthAccessKey
    AzureAuth <|.. AzureAuthDefault
    AzureAuth <|.. AzureAuthOauth
    AzureAuth <|.. AzureVendedAuth
    AzureVendedAuth --> AzureAuth : fallbackAuth
Loading

Class diagram for AzureFileSystemFactory authentication selection

classDiagram
    class AzureFileSystemFactory {
        +TrinoFileSystem create(ConnectorIdentity identity)
        -static AzureAuth withVendedAuth(ConnectorIdentity identity, AzureAuth defaultAuth)
    }
    class AzureAuth
    class AzureVendedAuth
    AzureFileSystemFactory --> AzureAuth
    AzureFileSystemFactory --> AzureVendedAuth
Loading

File-Level Changes

Change Details Files
Unify vended credential logic in IcebergRestCatalogFileSystemFactory and add Azure SAS token support
  • Replaced S3-only credential block with a builder handling both S3 access keys and Azure SAS tokens
  • Added getAzureCredentials helper to extract per-account SAS tokens from properties
  • Adjusted identity creation to use overridden credentials when available
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/rest/IcebergRestCatalogFileSystemFactory.java
Propagate vended credentials into Azure filesystem factory
  • Wrapped default AzureAuth with withVendedAuth in AzureFileSystemFactory.create
  • Implemented withVendedAuth to choose between fallback and vended credentials from ConnectorIdentity
lib/trino-filesystem-azure/src/main/java/io/trino/filesystem/azure/AzureFileSystemFactory.java
Introduce AzureVendedAuth implementation and related constants
  • Extended AzureAuth sealed interface to permit AzureVendedAuth
  • Added AzureVendedAuth class to apply SAS token or fallback auth per storage account
  • Defined AzureFileSystemConstants.EXTRA_SAS_TOKEN_PROPERTY_PREFIX for SAS token keys
lib/trino-filesystem-azure/src/main/java/io/trino/filesystem/azure/AzureAuth.java
lib/trino-filesystem-azure/src/main/java/io/trino/filesystem/azure/AzureVendedAuth.java
lib/trino-filesystem-azure/src/main/java/io/trino/filesystem/azure/AzureFileSystemConstants.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

cla-bot bot commented Oct 12, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Sreesh Maheshwar.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails


public sealed interface AzureAuth
permits AzureAuthAccessKey, AzureAuthDefault, AzureAuthOauth
permits AzureAuthAccessKey, AzureAuthDefault, AzureAuthOauth, AzureVendedAuth
Copy link
Author

Choose a reason for hiding this comment

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

Introducing this new auth means that with this PR,

return switch (azureAuth) {
case AzureAuthOauth _ -> oauth2PresignedUri(location, ttl, Optional.empty());
case AzureAuthAccessKey _ -> accessKeyPresignedUri(location, ttl, Optional.empty());
default -> throw new UnsupportedOperationException("Unsupported azure auth: " + azureAuth);
};

throws.

Maybe this is fine for now, as I see it's not supported even for default auth?

Copy link
Author

Choose a reason for hiding this comment

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

Also highlighting that I'm not adding this type to

public enum AuthType
{
ACCESS_KEY,
OAUTH,
DEFAULT,
}

I think that this should be an internal auth type that cannot enabled by config. Though I appreciate this design of an internal, IRC-centred auth may be controversial.

@Override
public void setAuth(String storageAccount, BlobContainerClientBuilder builder)
{
getSasToken(storageAccount)
Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

Please add a test.

@smaheshwar-pltr
Copy link
Author

@ebyhr yes, sounds good! (Currently, still a WIP and completely untested)

While I have you here, may you elaborate on what sort of tests you'd like for this PR? I see TestIcebergTrinoRestCatalogConnectorSmokeTest and TestIcebergPolarisCatalogConnectorSmokeTest but not sure how doable wiring up such a test suite with an Azure storage IRC is.

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.

Iceberg REST Catalog: Support for vended credentials for Azure

2 participants