Skip to content

feat(aws): add STS AssumeRole granter - #813

Merged
Xuanwo merged 2 commits into
mainfrom
xuanwo/aws-assume-role-granter
Jul 31, 2026
Merged

feat(aws): add STS AssumeRole granter#813
Xuanwo merged 2 commits into
mainfrom
xuanwo/aws-assume-role-granter

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 31, 2026

Copy link
Copy Markdown
Member

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 retaining AssumeRoleCredentialProvider as the fixed-flow compatibility API.

Part of #807.

Live AWS acceptance remains gated on an authorized AssumeRole environment.

@Xuanwo
Xuanwo marked this pull request as ready for review July 31, 2026 07:07
@Xuanwo
Xuanwo merged commit bb2b463 into main Jul 31, 2026
48 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/aws-assume-role-granter branch July 31, 2026 09:35
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.
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