Skip to content

feat(s3): add sessionToken support for temporary AWS credentials#777

Open
esroyo wants to merge 2 commits into
unjs:mainfrom
esroyo:feat/s3-session-token
Open

feat(s3): add sessionToken support for temporary AWS credentials#777
esroyo wants to merge 2 commits into
unjs:mainfrom
esroyo:feat/s3-session-token

Conversation

@esroyo

@esroyo esroyo commented May 21, 2026

Copy link
Copy Markdown

Adds sessionToken option to S3 driver for temporary AWS credentials. This is a pass-through to the sessionToken parameter already supported by aws4fetch library.

Summary by CodeRabbit

  • New Features

    • S3 driver accepts an optional session token for temporary credentials, improving authentication flexibility.
  • Chores

    • Tracing wrapper type signatures were refined for clearer typings and developer ergonomics; runtime tracing behavior remains unchanged.

Review Change Stack

@esroyo esroyo requested a review from pi0 as a code owner May 21, 2026 15:52
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: abdf4c48-ebc8-4e27-9568-229f199e6e80

📥 Commits

Reviewing files that changed from the base of the PR and between f32db6a and 1a7bac6.

📒 Files selected for processing (1)
  • src/tracing.ts

📝 Walkthrough

Walkthrough

Adds an optional sessionToken to the S3 driver options and forwards it to the AwsClient; refactors tracing typings to attach an internal traced brand and preserve the original storage type when returning a traced wrapper.

Changes

S3 Session Token Support

Layer / File(s) Summary
Add sessionToken configuration to S3 driver
src/drivers/s3.ts
S3DriverOptions adds an optional sessionToken property with docs, and the token is passed into the AwsClient constructor configuration.

Tracing type adjustments

Layer / File(s) Summary
Introduce TracedBrand and update withTracing signature
src/tracing.ts
Adds an internal TracedBrand marker and adjusts withTracing overloads to accept Storage<any> and return the original T (now created as T & TracedBrand); updates the tracedStorage construction and wrapper assignment indexing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I found a token tucked in the sky,
Popped it in config, waved creds goodbye,
I stitched a small brand to the storage I trace,
Kept the shape the same while it hopped in place,
Patch done — a nibble, a hop, and a tiny sky-high cry.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding sessionToken support to the S3 driver for temporary AWS credentials.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@esroyo esroyo force-pushed the feat/s3-session-token branch from 3dbe173 to f32db6a Compare May 21, 2026 22:05
@esroyo esroyo force-pushed the feat/s3-session-token branch from f32db6a to 1a7bac6 Compare May 21, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant