You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "xxzuo (via GitHub)" <gi...@apache.org> on 2026/04/02 15:00:34 UTC
[I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
xxzuo opened a new issue, #10702:
URL: https://github.com/apache/seatunnel/issues/10702
### Search before asking
- [x] I had searched in the [feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement.
### Description
Currently, the OssFile connector (both source and sink) only supports a single authentication mode: directly configuring `access_key` and `access_secret` in the job configuration file. This has significant security and usability limitations in cloud environments.
This feature proposes adding support for multiple OSS credential providers through a new configuration option `fs.oss.credentials.provider`, which accepts a list of provider class names and tries them in order (chain pattern) until one succeeds.
**Proposed Authentication Modes:**
| Mode | Provider Class | Description |
|------|---------------|-------------|
| AK/SK from config | (default, no provider needed) | Backward compatible, reads `access_key`/`access_secret` from config file |
| Environment variables | `EnvironmentVariableCredentialsProvider` | Reads `OSS_ACCESS_KEY_ID` / `OSS_ACCESS_KEY_SECRET` from environment variables |
| ECS RAM Role | `OssInstanceProfileCredentialsProvider` | Credential-free access via ECS metadata service, requires `role_name` |
| STS Token | `OssStsCredentialsProvider` | Temporary credentials with `access_key`, `access_secret` and `security_token` |
**New Configuration Options:**
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `fs.oss.credentials.provider` | `List<String>` | No | Credential provider class names, tried in order |
| `role_name` | `String` | No | ECS RAM role name (for InstanceProfile provider) |
| `security_token` | `String` | No | STS security token (for STS provider) |
**Design Details:**
1. **Backward compatible**: When `fs.oss.credentials.provider` is not configured, the connector falls back to the existing `access_key`/`access_secret` behavior. No breaking changes.
2. **Provider chain**: Multiple providers can be configured as a chain. For example, try environment variables first, then fall back to ECS RAM role:
```hocon
fs.oss.credentials.provider = [
".EnvironmentVariableCredentialsProvider",
"OssInstanceProfileCredentialsProvider"
]
```
3. **hadoop-aliyun integration**:
- Single provider → set directly on `fs.oss.credentials.provider` (native hadoop-aliyun key)
- Multiple providers → use a custom `OssCredentialProviderChain` class that is set as the provider, with the chain list stored in a separate configuration key `fs.oss.credentials.provider.chain`
4. **Wrapper providers**: The OSS SDK's `InstanceProfileCredentialsProvider(String roleName)` and `DefaultCredentialProvider(ak, sk, token)` constructors are incompatible with hadoop-aliyun's reflection mechanism `(URI, Configuration)`. Two wrapper classes are needed:
- `OssInstanceProfileCredentialsProvider(URI, Configuration)` — reads `role_name` from Configuration and delegates to the SDK's InstanceProfileCredentialsProvider
- `OssStsCredentialsProvider(URI, Configuration)` — reads AK/SK/Token from Configuration and delegates to the SDK's DefaultCredentialProvider
5. **Sink factory change**: `access_key` and `access_secret` change from `required` to `optional` in OssFileSinkFactory (Source already has them as optional).
### Usage Scenario
1. **ECS deployment (most common)**: When SeaTunnel runs on Alibaba Cloud ECS instances, users want to avoid hardcoding AK/SK in config files. Using ECS RAM roles allows automatic, credential-free access to OSS with automatic key rotation.
2. **Temporary access**: When third-party applications need temporary OSS access, STS tokens provide time-limited credentials that automatically expire, improving security.
3. **Multi-environment deployment**: Using provider chains allows the same configuration to work across different environments (e.g., ECS in production with RAM role, local development with environment variables).
### Related issues
_No response_
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "chl-wxp (via GitHub)" <gi...@apache.org>.
chl-wxp commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4184089944
good joob
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4199229166
Thanks for raising this.
I think the requirement is reasonable, and from a SeaTunnel configuration perspective I would lean toward an explicit authentication mode rather than an implicit provider chain.
Right now the OssFile factories are still centered around the existing static credential style, so a safer direction would be:
1. keep the current AK/SK behavior fully backward compatible
2. add an explicit auth mode / credential provider option
3. document clearly which parameters are required for each mode
That gives users predictable behavior and makes troubleshooting much easier than a silent fallback chain.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "xxzuo (via GitHub)" <gi...@apache.org>.
xxzuo commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4186268448
> Thanks for your report, it's excellent. I suggest we also consider `AWS` ,`Google` cloud
>
> Currently the implementation only supports Alibaba Cloud ECS, so maybe we should make it more general-purpose. Some users may not only use Alibaba Cloud, so should we take multi-cloud users into account?
Yeah, we should consider the situation of multi-cloud users. but cloud IAM role-based authentication is inherently tied to the cloud provider's own infrastructure — by default, we can only use RAM roles for credential-free OSS access on Alibaba Cloud machines, and IAM roles for credential-free S3 access on AWS machines.
so I suggest implementing credential-free access to multi-cloud object storage in phases.
Phase 1: Focus on enabling credential-free (IAM role) access for each cloud's own object storage connector individually — OSS, S3, GCS, COS etc.
Phase 2: Address cross-cloud credential management, which is closely tied to the network topology and deployment model. For example, in a scenario where the source is OSS and the sink is S3, could we consider supporting the source running on an Aliyun machine and the sink running on an AWS machine?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4189096556
Hi @xxzuo, thanks for the proposal! Supporting multiple credential providers for OssFile is definitely needed. I'd like to share some thoughts on the design approach.
### Concern about the provider chain pattern
The chain/list-based approach (try providers in order until one succeeds) is common in cloud SDKs, but may not be the best fit for SeaTunnel:
- **SeaTunnel is declarative** — users write explicit job configs and know their deployment environment. Unlike an SDK that auto-detects runtime, users can and should specify which auth mode they want.
- **Debugging difficulty** — if Provider A fails silently and Provider B succeeds with unexpected credentials, troubleshooting becomes harder.
- **Validation complexity** — with a chain, it's hard to fail-fast on missing params (e.g., `role_name` not set for ECS RAM Role would silently fall through instead of erroring).
### Existing precedent: S3File connector
SeaTunnel already solved this for S3 with an **explicit enum-based approach** — see [`S3FileBaseOptions.S3aAwsCredentialsProvider`](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/connector-file/connector-file-s3/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/s3/config/S3FileBaseOptions.java#L65) enum and [`S3FileSourceFactory.optionRule()`](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/connector-file/connector-file-s3/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/s3/source/S3FileSourceFactory.java#L61-L65) which uses `conditional()` to require `access_key`/`secret_key` only when `SimpleAWSCredentialsProvider` is selected. Clean and explicit.
### Suggested approach
Follow the same pattern for OssFile — add an enum-based `fs.oss.credentials.provider` option:
| auth mode | required params | description |
|-----------|----------------|-------------|
| `AK_SK` (default) | `access_key`, `access_secret` | backward compatible |
| `ENV_VARIABLE` | none | reads from env vars |
| `ECS_RAM_ROLE` | `role_name` | credential-free via ECS metadata |
| `STS_TOKEN` | `access_key`, `access_secret`, `security_token` | temporary credentials |
**Benefits**: consistent with S3File design, explicit & predictable, fail-fast validation per mode, fully backward compatible.
I think this approach would be simpler to implement and easier for users to understand. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "xxzuo (via GitHub)" <gi...@apache.org>.
xxzuo commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4200626689
> Hi [@xxzuo](https://github.com/xxzuo), thanks for the proposal. Supporting multiple credential providers for OssFile is definitely needed. I'd like to share some thoughts on the design approach.
>
> ### Concern about the provider chain pattern
> The chain/list-based approach (try providers in order until one succeeds) is common in cloud SDKs, but may not be the best fit for SeaTunnel:
>
> * **SeaTunnel is declarative** — users write explicit job configs and know their deployment environment. Unlike an SDK that auto-detects runtime, users can and should specify which auth mode they want.
> * **Debugging difficulty** — if Provider A fails silently and Provider B succeeds with unexpected credentials, troubleshooting becomes harder.
> * **Validation complexity** — with a chain, it's hard to fail-fast on missing params (e.g., `role_name` not set for ECS RAM Role would silently fall through instead of erroring).
>
> ### Existing precedent: S3File connector
> SeaTunnel already solved this for S3 with an **explicit enum-based approach** — see [`S3FileBaseOptions.S3aAwsCredentialsProvider`](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/connector-file/connector-file-s3/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/s3/config/S3FileBaseOptions.java#L65) enum and [`S3FileSourceFactory.optionRule()`](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/connector-file/connector-file-s3/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/s3/source/S3FileSourceFactory.java#L61-L65) which uses `conditional()` to require `access_key`/`secret_key` only when `SimpleAWSCredentialsProvider` is selected. Clean and explicit.
>
> ### Suggested approach
> Follow the same pattern for OssFile — add an enum-based `fs.oss.credentials.provider` option:
>
> auth mode required params description
> `AK_SK` (default) `access_key`, `access_secret` backward compatible
> `ENV_VARIABLE` none reads from env vars
> `ECS_RAM_ROLE` `role_name` credential-free via ECS metadata
> `STS_TOKEN` `access_key`, `access_secret`, `security_token` temporary credentials
> **Benefits**: consistent with S3File design, explicit & predictable, fail-fast validation per mode, fully backward compatible.
>
> I think this approach would be simpler to implement and easier for users to understand. What do you think?
You're right, that makes it clearer. I considered this design.
| auth_mode | required | desc |
|----------|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| simple (default) | `access_key`, `access_secret` | Simple authentication mode using access key ID and access key secret. |
| sts | `access_key`, `access_secret`, `sts_token` | STS authentication mode using access key ID, access key secret, and sts token. |
| env | none | Environment variable authentication mode not need config, but use the environment variables `OSS_ACCESS_KEY_ID` and `OSS_ACCESS_KEY_SECRET` and `OSS_SECURITY_TOKEN`(optional). |
| role | `role_name` | Must deploy in Alibaba Cloud ECS, and use the role name to authenticate. |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4203450123
Thanks for iterating on the design here. I checked the current OSS path again: the sink factory still requires `access_key` / `access_secret`, and the Hadoop config assembly writes those values directly, so the connector does not yet have a real credential-provider abstraction. In contrast, S3 already uses an explicit provider enum, which is a good precedent for SeaTunnel's declarative config style.
So I agree with the latest direction: this should be modeled as an explicit auth mode rather than a silent provider chain. Your `simple / sts / env / role` breakdown looks reasonable. I do not see a dev PR linked to this issue yet, so the best next step is probably a small implementation that keeps AK/SK fully backward compatible, validates required parameters per mode, and updates both EN and ZH OssFile docs together.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature][Connector-V2] Support multiple credential providers for OssFile connector [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on issue #10702:
URL: https://github.com/apache/seatunnel/issues/10702#issuecomment-4183931214
Thanks for your report, it's excellent.
I suggest we also take into account `AWS`, `Google Cloud`, and `Kubernetes` containerized deployments.
At present, the solution only supports Alibaba Cloud ECS, so wouldn’t it be better to make it more general-purpose?
Some users may not use Alibaba Cloud exclusively — should we consider multi-cloud users?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org