Skip to content

feat(object-store): add explicit IRSA and ECS credential storage options - #8103

Open
westonpace wants to merge 5 commits into
lance-format:mainfrom
westonpace:feat/explicit-credential-storage-options
Open

feat(object-store): add explicit IRSA and ECS credential storage options#8103
westonpace wants to merge 5 commits into
lance-format:mainfrom
westonpace:feat/explicit-credential-storage-options

Conversation

@westonpace

@westonpace westonpace commented Jul 30, 2026

Copy link
Copy Markdown
Member

We can programmatically set access key id / secret key via storage_options. However, there is no way to programmatically configure IRSA or ECS authentication methods.

This was a problem for a user that wanted to connect to two different buckets, one with IRSA, and the other with ECS. Since they had environment variables set for both IRSA and ECS then AWS would always prefer IRSA.

This PR adds a new storage option, aws_provider_scheme, which can be used in this situation. If set to irsa then it will configure a provider chain that only looks for IRSA environment variables (and will fail if they are not set). If set to ecs then it will configure a provider chain that only looks for ECS environment variables (and will fail if they are not set). I also added token just for completeness.

@github-actions github-actions Bot added enhancement New feature or request A-deps Dependency updates A-encoding Encoding, IO, file reader/writer labels Jul 30, 2026
@westonpace
westonpace force-pushed the feat/explicit-credential-storage-options branch from fcd4f6d to 1ae2274 Compare July 30, 2026 19:53
Users connecting to two S3 buckets with different AWS auth methods (e.g.
IRSA for one, ECS/pod identity for another) previously had no way to
override credential resolution per-bucket because DefaultCredentialsChain
reads the process environment and ProviderConfig::with_env() is pub(crate).

This adds new storage options to explicitly configure AWS credential
providers without relying on environment variables:
- IRSA: aws_web_identity_token_file + aws_role_arn (+ optional aws_role_session_name)
- ECS: aws_container_credentials_full_uri or aws_container_credentials_relative_uri
  (+ optional aws_container_authorization_token_file)

Credential resolution precedence: static access keys → IRSA → ECS → DefaultCredentialsChain.

The key design: with_env_s3() now excludes credential-selection keys
(WebIdentityTokenFile, RoleArn, ContainerCredentials*, etc.) from environment injection.
DefaultCredentialsChain already reads these from the process environment directly, so
omitting them from injection loses nothing. After this change, any IRSA/ECS key in
the storage options map can only have come from the user — explicit options naturally
take precedence over environment variables with no additional tracking needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.97880% with 51 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-io/src/object_store/providers/aws.rs 81.97% 46 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@westonpace
westonpace force-pushed the feat/explicit-credential-storage-options branch from 1ae2274 to 1112178 Compare July 30, 2026 20:58
@github-actions github-actions Bot added the A-docs Documentation label Jul 30, 2026
@westonpace
westonpace marked this pull request as ready for review July 31, 2026 12:58
@westonpace

Copy link
Copy Markdown
Member Author

I attempted several other approaches:

  • My first attempt was to allow users to mask out environment variables by setting a storage option to an empty string. This failed because the method in AWS to override the environment is pub(crate) and only intended for testing.
  • My second attempt was to allow IRSA and ECS to be configured via storage options. This failed because AWS' ECS provider does not allow programmatic configuration (oddly, the IRSA provider does)
  • My third attempt was was to use storage options to pick which providers to use. If IRSA storage options were set then only configure the IRSA provider. If ECS storage options were set then only configure the ECS provider. This kind of worked but, since there is no way to programmatically configure the ECS provider, it led to a strange situation where ECS storage_options could be used to pick the provider but the actual value of the option would be ignored. This would work, but was kind of weird.

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

Labels

A-deps Dependency updates A-docs Documentation A-encoding Encoding, IO, file reader/writer enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant