Skip to content

feat: temporary credentials in storage, iam and the CLI - #430

Open
designcode wants to merge 6 commits into
mainfrom
aibrahim/temporary-credentials
Open

designcode wants to merge 6 commits into
mainfrom
aibrahim/temporary-credentials

Conversation

@designcode

@designcode designcode commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Adds support for Tigris temporary credentials (STS GetFederationToken) across the SDKs and the CLI. One commit per package.

@tigrisdata/storage: accept temporary credentials

  • sessionToken together with accessKeyId and secretAccessKey is now signed as an STS session token (x-amz-security-token). On its own it is still an OAuth token, as before.
  • Reads TIGRIS_STORAGE_SESSION_TOKEN alongside the key variables.
  • credentialProvider no longer requires an organization, so it can return refreshing temporary credentials.
  • An OAuth sessionToken keeps priority over access keys from the environment.

@tigrisdata/iam: issue temporary credentials

  • createTemporaryCredentials(name, { bucket, access | actions | policy, durationSeconds }) returns credentials ready to spread into the storage config.
  • Validates the name, duration, actions and the 2048-byte policy limit before calling STS. Gateway XML errors come back as their message.
  • iam now declares @smithy/signature-v4, @aws-crypto/sha256-js and @aws-sdk/xml-builder instead of bundling private copies (dist 84 KB → 31 KB). AGENTS.md documents the rule.

@tigrisdata/cli: issue and use temporary credentials

  • tigris credentials temporary <bucket> --name <name> --access read|write|readwrite (or --actions, --policy), --duration (default 1h), --export [--for aws].
  • Logged in with OAuth, which STS refuses, the command offers to create an access key for the bucket (ReadOnly or ReadWrite, no default permissions) or to stop so the user can log in with an access key.
  • The CLI authenticates with temporary credentials from AWS_SESSION_TOKEN, TIGRIS_STORAGE_SESSION_TOKEN or an AWS profile, and explains their limits in access errors, whoami, credentials test and the IAM commands.

Testing

  • Wire format, OAuth refusal and error shapes verified against production with a SigV4 probe.
  • Unit tests in all three packages, plus an iam integration test that issues read-only credentials, lists the bucket and gets a 403 on PUT.
  • Not yet run end to end through the CLI against the gateway, in particular the OAuth key-creation flow.

Changesets: storage minor, iam minor, CLI minor.

🤖 Generated with Claude Code


Note

High Risk
Touches authentication, credential classification (OAuth vs STS), and signing across packages, including a breaking semantic change when keys and OAuth session coexist; IAM/STS issuance requires access keys and affects permission boundaries.

Overview
Adds end-to-end temporary credentials (STS GetFederationToken) across @tigrisdata/iam, @tigrisdata/storage, and the CLI.

IAM exposes createTemporaryCredentials with bucket-scoped read/write/readwrite, custom actions, or a JSON policy, plus STS client wiring and validation (duration, policy size, action allow-list). Shared HTTP signing now includes x-amz-security-token for key+session pairs, supports an sts SigV4 service name, and surfaces XML gateway Message text for S3/STS errors. IAM stops bundling duplicate crypto/XML deps in favor of declared shared versions.

Storage distinguishes STS session tokens (with access keys) from OAuth tokens (session alone + org), reads TIGRIS_STORAGE_SESSION_TOKEN, allows credentialProvider without organizationId, and updates client caching/signing accordingly—including a behavior change: access keys plus OAuth session+org are now treated as temporary credentials, not OAuth.

CLI adds tigris credentials temporary (--access/--actions/--policy, --duration, --export [--for aws|tigris]), authenticates via env/profile session tokens, blocks IAM/access-key flows on temp creds with clearer errors, and improves whoami, credentials test, and permission-denied messaging.

Reviewed by Cursor Bugbot for commit b2b50e5. Bugbot is set up for automated code reviews on this repo. Configure here.

designcode and others added 3 commits November 24, 2026 14:32
A session token passed with its access key pair is now signed into
every request, in both the S3 client and the HTTP client behind copy,
move and updateObject. TIGRIS_STORAGE_SESSION_TOKEN supplies it from
the environment. A session token on its own is still an OAuth token,
and an OAuth token still wins over a key pair. A credentialProvider
no longer needs organizationId, so it can return renewable temporary
credentials.

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createTemporaryCredentials calls STS GetFederationToken to issue
credentials limited to one bucket, from an access level, exact
actions, or a full policy. It checks the name, duration, policy size
and actions before calling STS, and the result plugs into
@tigrisdata/storage as static credentials or a credentialProvider.

The shared HTTP client can now sign for a service other than s3, and
reads the message out of XML error bodies with the AWS SDK's XML
parser instead of reporting only the status text.

iam now declares the AWS packages it pulls in through shared/ instead
of bundling its own copies, so apps using it with @tigrisdata/storage
load one copy of each.

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `tigris credentials temporary <bucket> --name <name>` to issue STS
credentials limited to one bucket, by access level, exact actions or a
policy file, lasting --duration (default 1h). --export prints shell
export lines, with --for aws for the AWS variable names.

Logged in with OAuth, which can't issue them, the command offers to
create an access key for the bucket (ReadOnly or ReadWrite, matching
the grant) or to stop so the user can log in with an access key.

The CLI also authenticates with temporary credentials from
AWS_SESSION_TOKEN, TIGRIS_STORAGE_SESSION_TOKEN or an AWS profile, and
explains what they can't do in access errors, whoami, credentials test
and the IAM commands.

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bc7bba7. Configure here.

Comment thread packages/storage/src/lib/config.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no new blocking issues were found.

Summary

Adds temporary credentials across storage, IAM, and the CLI.

  • Storage requests can use temporary credentials alongside OAuth tokens.
  • The IAM SDK can issue policy-limited temporary credentials through STS.
  • The CLI can issue temporary credentials and print them for a shell or SDK.
  • The CLI recognizes temporary credentials and explains their limits.

Reviews (4) · Last reviewed commit: "fix(cli): resolve export endpoints befor..." · Reviewed by Greptile

Comment thread packages/storage/src/lib/config.ts Resolved
Comment thread packages/storage/README.md Resolved
designcode and others added 3 commits November 25, 2026 13:55
TIGRIS_STORAGE_SESSION_TOKEN only counts as temporary credentials when
the key variables are set too; a leftover token no longer hides an
OAuth session from the environment. The README example issues
readwrite credentials, so its list call works.

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- credentials test passes temporary credentials whose policy only
  denies listing, such as write-only ones
- --policy can't be combined with a bucket, --access or --actions
- a key created through the OAuth flow is deleted when nothing is issued
- access-keys create --env removes a session token left by temporary
  credentials

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failure there exited after the OAuth flow had created a key, before
the cleanup that deletes it could run.

Assisted-by: Claude Opus 5.5 via Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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