rustfs / rustfs/cli

feat: implement AWS temporary session based interactions

Open
#167 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
152
Forks
20
Avg merge
1d 3h
Merged PRs (30d)
27

Description

Description

Implement support for AWS session tokens to enable temporary, role-based interactions with S3-compatible backends. To maintain a seamless user experience, aliases utilizing expired session tokens will be automatically pruned from the configuration upon detection.

Requirements

  • Core Alias Updates: Update the Alias configuration to support an optional session token using #[serde(default)] for backward compatibility.
  • Security: Implement a custom fmt::Debug for the Alias struct to ensure session tokens and secret keys are scrubbed from logs.
  • Credential Injection: Modify S3Client and AdminClient to inject the session token into the AWS credentials provider.
  • Error Handling: Introduce a TokenExpired(String) error variant and map AWS ExpiredToken / InvalidToken errors to it.
  • CLI Auto-Pruning: Intercept TokenExpired errors at the CLI boundary to log a clear message, automatically remove the dead alias from config.toml, and exit gracefully.

Acceptance Criteria

  • rc alias set supports a new --session-token flag.
  • Configuration changes include a schema_version bump and a migration path (migrations/).
  • schemas/output_v2.json is updated to include the session_token field in the aliasInfo definition.
  • Static credentials continue to function normally when the session token is omitted.
  • CLI correctly identifies an expired token, logs a helpful warning, deletes the alias, and exits with AUTH_ERROR (Code 4).
  • Debug/verbose logs strictly mask the session token as ***REDACTED***.
  • Golden tests are successfully regenerated (UPDATE_GOLDEN=1 cargo test --features golden) and pass.
  • Pre-commit checks (cargo fmt --all, cargo clippy --workspace -- -D warnings) pass with zero warnings.

Notes

This change impacts the Alias struct in crates/core, triggering the Breaking Change process outlined in AGENTS.md. The aws-sigv4 crate automatically handles the X-Amz-Security-Token header during request signing.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Alias struct in crates/core and read AGENTS.md for the breaking-change process. Trace S3Client, AdminClient, the CLI alias set entry point, migrations/, and schemas/output_v2.json, then inspect the golden tests. Done means session-token configuration, expiry handling, redaction, migration, schema updates, and the listed cargo checks all pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
backend, cli, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.