feat(aws): add STS AssumeRole granter - #813
Merged
Merged
Conversation
Xuanwo
marked this pull request as ready for review
July 31, 2026 07:07
12 tasks
This was referenced Aug 17, 2026
Xuanwo
pushed a commit
that referenced
this pull request
Aug 27, 2026
Resolves #847. Part of #807. Adds `AssumeRoleGrant` and `AssumeRoleGranter` for Alibaba Cloud RAM STS `AssumeRole`, implementing `GrantCredential` in the same shape as the AWS granter (#813). The source credential supplied by `Granter` signs the STS request directly; the returned credential carries exact `Expiration` and is never cached. `expires_in` maps to `DurationSeconds` (900..=43200), and an optional inline session `Policy` is supported. The STS request build, HMAC-SHA1 signing, and response parsing are extracted into a shared `assume_role` module that both the granter and the existing `AssumeRoleCredentialProvider` reuse. The provider keeps its public API and `ProvideCredential` is unchanged. ## Testing - `cargo fmt`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test` all pass. - Deterministic tests over a mock `HttpSend`: golden signature over the exact signed parameter set, parameter assertions, and the source-validation, duration-range, and post-I/O expiry error paths. The existing provider signature test still passes, confirming the extracted signing is byte-identical. - Validated end to end against real Alibaba Cloud STS: a base RAM user credential assumes a role and receives a valid temporary credential. Real-service CI coverage needs Actions secrets and is tracked in #825; happy to follow up on that wiring. This change was written with AI assistance; I have reviewed and understand it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AWS STS AssumeRole is the first authority-transition flow that exercises reqsign's scoped credential-granting architecture on AWS. The source credential must authorize each STS exchange while the resulting credential derives authority from the target role, so this cannot be modeled as monotonic downscoping or through a generic provider adapter.
This PR exposes that flow through the existing one-generic
Granter<K>composition while retainingAssumeRoleCredentialProvideras the fixed-flow compatibility API.Part of #807.
Live AWS acceptance remains gated on an authorized AssumeRole environment.