Skip to content

feat(services/s3): support explicit AWS profiles - #7949

Open
Xuanwo wants to merge 7 commits into
mainfrom
xuanwo/issue-7944-s3-profile
Open

feat(services/s3): support explicit AWS profiles#7949
Xuanwo wants to merge 7 commits into
mainfrom
xuanwo/issue-7944-s3-profile

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 24, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #7944.

Rationale for this change

S3Builder currently either uses the ambient AWS_PROFILE or requires callers to replace the complete credential provider chain. This prevents applications from selecting different AWS profiles for different S3 operators while keeping OpenDAL's default credential resolution behavior.

reqsign now provides an aggregate profile selector on its default AWS credential provider builder, so OpenDAL can expose per-builder profile selection without reconstructing or wrapping the provider chain locally.

What changes are included in this PR?

  • Add S3Config::profile, its aws_profile alias, and S3Builder::profile.
  • Apply the configured profile through reqsign's DefaultCredentialProviderBuilder::with_profile, preserving explicit profile > AWS_PROFILE > default precedence.
  • Keep disable_config_load authoritative and leave custom credential_provider_chain behavior unchanged.
  • Use the formally released reqsign v0.20.4 component crates from crates.io: reqsign-aws-v4 3.1.0, reqsign-core 3.2.1, and reqsign-file-read-tokio 3.0.4.
  • Regenerate the Java, Python, and website service configuration outputs and update the Ruby lockfile.
  • Add focused coverage for the S3 configuration field, compatibility alias, and builder setter.

Are there any user-facing changes?

Yes. S3 users can select an AWS profile per builder through S3Builder::profile, profile in serialized configuration, or the aws_profile compatibility alias. The selected profile is forwarded to the reqsign default profile provider and applies to shared AWS config and credentials files and SSO. This PR does not change command execution support for credential_process.

This change is additive and does not alter credential resolution when no explicit profile is configured.

Validation

  • cargo test --locked -p opendal-service-s3 — 25 unit tests and 8 doctests passed; 7 doctests were ignored.
  • cargo clippy --locked -p opendal-service-s3 --all-targets -- -D warnings
  • cargo build --locked --target wasm32-unknown-unknown --no-default-features --features=services-s3
  • cargo check --workspace --all-targets --all-features --locked
  • cargo check in bindings/python and bindings/java
  • cargo fmt --all -- --check
  • ./scripts/workspace.py cargo fmt -- --check
  • taplo format --check

The Ruby lockfile resolves all reqsign packages from crates.io. A local cargo check --locked compiled the OpenDAL and reqsign crates, then stopped in rb-sys because the macOS system Ruby 2.6 installation cannot provide the required Stable API; Ruby CI uses the repository's Ruby 3.3 toolchain.

AI Usage Statement

OpenAI Codex with a GPT-5 model assisted with analysis, implementation, and validation.

@Xuanwo
Xuanwo marked this pull request as ready for review August 5, 2026 05:22
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Aug 5, 2026
@Xuanwo
Xuanwo requested a review from erickguan August 5, 2026 05:23
Comment thread core/services/s3/src/core.rs Outdated
.with_http_send(ctx.http_transport().clone())
.with_env(reqsign_core::OsEnv),
.with_env(OsEnv)
.with_command_execute(TokioCommandExecute),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Irrelevant change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it needed later or just random modification?

@tisonkun tisonkun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I remember apache/opendal-reqsign#792 and wonder why we should handle this credential loading thing in opendal rather than reqsign.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 5, 2026
@Xuanwo

Xuanwo commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

I remember apache/opendal-reqsign#792 and wonder why we should handle this credential loading thing in opendal rather than reqsign.

Yep, a not needed helper function. I have removed it.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 5, 2026
Comment on lines +97 to +101
/// AWS profile used by the default credential provider chain.
///
/// This profile takes precedence over the `AWS_PROFILE` environment
/// variable and applies to shared AWS config and credentials files and SSO.
///

@erickguan erickguan Aug 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// AWS profile used by the default credential provider chain.
///
/// This profile takes precedence over the `AWS_PROFILE` environment
/// variable and applies to shared AWS config and credentials files and SSO.
///
/// AWS profile.
///
/// By default, reqsign which is the default credential provider, supplies profile in order:
/// - explicit option
/// - `AWS_PROFILE` environment variable, from which reqsign reads profile from:
/// - `~/.aws/credentials` (or the path specified by `AWS_SHARED_CREDENTIALS_FILE`)
/// - `~/.aws/config` (or the path specified by `AWS_CONFIG_FILE`)

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

Labels

lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new feature: Allow S3Builder to select an AWS profile explicitly

3 participants