Skip to content

feat(volcengine-tos): add STS AssumeRole granter - #965

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/add-volcengine-sts-credentials
Nov 19, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/add-volcengine-sts-credentials

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 19, 2026

Copy link
Copy Markdown
Member

Adds the Volcengine TOS increment of the GrantCredential tracker: AssumeRoleGrant and AssumeRoleGranter consume an existing long-lived or eligible temporary Volcengine credential, call the regional STS AssumeRole OpenAPI, and return the existing TOS Credential with the issued access key, secret key, session token, and authoritative ExpiredTime.

The request uses the OpenAPI HMAC-SHA256 signature scheme with the <date>/<region>/sts/request scope, separate from TOS4 signing. It binds the target role TRN, session name, optional inline policy, and region. Explicit durations must be whole seconds in 900..=43200; None omits DurationSeconds and uses the service default. Temporary source tokens are sent in X-Security-Token and included in the signed headers. The default provider chain is unchanged, and granted output is never cached.

Credential now carries expires_at. Existing constructors keep their previous behavior and leave expiration unset; adding the field breaks struct-literal construction, so the service README changelog tells those callers to switch to constructors. Header signing enforces expiry at the signing time, while presigning requires the credential to cover the full requested URL lifetime. The server-provided ExpiredTime is used directly; neither CurrentTime nor the requested duration is substituted for it.

Validation was local and synthetic only:

  • A fixed signing vector calculated independently from the documented OpenAPI algorithm covers a long-lived source. A second vector covers a temporary source, signed X-Security-Token, and a policy containing spaces, +, %, &, and /.
  • Mock HttpSend tests cover invalid grant/duration/source rejection before I/O, endpoint validation, STS error mapping and redaction, malformed or missing response fields, exact post-I/O expiry, and credential use through Granter and Signer.
  • cargo fmt --all -- --check, workspace clippy with all targets/features and -D warnings, workspace tests, all-feature doctests, and WASM checks for the service and the facade volcengine feature pass.

No real credentials or cloud calls were used. Live STS/TOS acceptance remains with #825.

Closes #962. Parent tracker: #807.

Add AssumeRoleGrant and AssumeRoleGranter for Volcengine STS AssumeRole.
The granter consumes an existing long-lived or temporary Volcengine
credential, signs the regional OpenAPI request with HMAC-SHA256 and the
sts/request scope, and returns the existing TOS Credential with the issued
access key, secret key, session token, and exact ExpiredTime.

Add Credential::expires_at and enforce it at the exact requested signing
deadline. Header signing keeps checking the signing time, while presigning
now requires the credential to cover the full URL lifetime. Existing
constructors keep their previous behavior and leave expiration unset; the
service README records the struct-literal migration note.

Keep the default provider chain unchanged and do not add granted output
caching. STS failures, malformed responses, and already-expired output
return typed errors without exposing policies, credentials, or raw bodies.
@Xuanwo
Xuanwo merged commit f261468 into main Nov 19, 2026
59 of 60 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/add-volcengine-sts-credentials branch November 19, 2026 14:02
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.

feat(volcengine-tos): add STS AssumeRole granter for TOS

2 participants