Skip to content

feat(aws): resolve assume-role profile chains through SSO sources - #954

Merged
Xuanwo merged 4 commits into
mainfrom
xuanwo/resolve-sso-role-chains
Nov 19, 2026
Merged

Xuanwo merged 4 commits into
mainfrom
xuanwo/resolve-sso-role-chains

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 19, 2026

Copy link
Copy Markdown
Member

Fixes #856.

A selected profile with role_arn now resolves source_profile references to a static or SSO base, loads a named or legacy inline SSO source through the configured SSO slot, and assumes each role in order with the previous hop's credential. AWS_PROFILE and explicit with_profile(...) both drive the graph. no_sso() prevents SSO from participating, and role-chain or SSO failures stop resolution instead of selecting a later identity.

The graph is validated before SSO or STS network I/O: missing source profiles, cycles, both or unsupported credential_source, a missing STS region, and invalid grants produce actionable errors. Static sources, duration_seconds, and external_id are supported; credential_source-only role profiles remain explicitly unsupported.

To execute STS from the profile provider without a core-to-v4 dependency cycle or a second signing implementation, the SigV4 request body moved into reqsign-aws-core's hidden signing module and the public RequestSigner delegates to it. Crate boundaries and public re-exports are unchanged.

Validation uses synthetic profiles and mocked HTTP only, with no live cloud credentials:

  • cargo fmt --all -- --check
  • cargo clippy -p reqsign-aws-core -p reqsign-aws-v4 --all-targets --all-features -- -D warnings
  • cargo test -p reqsign-aws-core -p reqsign-aws-v4
  • cargo check -p reqsign-aws-core -p reqsign-aws-v4 --target wasm32-unknown-unknown
  • cargo check -p reqsign --features full

Coverage includes explicit and AWS_PROFILE selection, named SSO sources, multi-hop order and per-hop credentials, static sources, no_sso(), pre-I/O missing-source/cycle/conflict/region/invalid-ARN failures, and signer consumption of the final assumed credential.

Move the SigV4 request-signing body into the shared AWS core so internal STS operations can use the exact same implementation as the public request signer without adding a dependency on the SigV4 service crate.
Resolve a selected role profile through its source_profile graph, load a named or legacy SSO source through the configured SSO slot, and assume each role in order with the previous hop's credential. Validate missing sources, cycles, conflicting or unsupported credential_source, region, and grant fields before STS or SSO network I/O, and keep role-chain/SSO failures from selecting a later identity.
@Xuanwo
Xuanwo merged commit 172755e into main Nov 19, 2026
49 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/resolve-sso-role-chains branch November 19, 2026 23:13
Xuanwo added a commit that referenced this pull request Nov 19, 2026
Bring in the SSO AssumeRole provider chain and shared SigV4 signing
options from #954, plus the latest CI and website dependency updates.

Port the new shared signing path and role-chain tests to the two-layer
Context CryptoProvider resolution: pass the resolved provider through
sign_request_parts, generated signing keys, STS request construction, and
the role-chain fixtures. Preserve #954's profile selection, explicit
Single/Double canonicalization, S3 Express routing, and credential-chain
error behavior.
Xuanwo added a commit that referenced this pull request Nov 20, 2026
Service-account token caching removed `UnwindSafe` and `RefUnwindSafe`
from Google's `RequestSigner`, breaking downstream code that captures a
signer in `catch_unwind`. Protect the bounded, synchronous cache
operations with `std::sync::Mutex`, recover poisoned locks consistently
with the refresh-lock registry, and retain the asynchronous locks around
per-partition token exchanges. A compile-time assertion guards both
public auto-trait implementations.

Assign minor versions to crates with new public capabilities and align
the root workspace dependency requirements:

| Crate | Released | Next | New capability |
| ------------------------ | -------- | ----- |
--------------------------------------------------- |
| `reqsign-aws-core` | 3.3.0 | 3.4.0 | Configurable canonical URI
encoding |
| `reqsign-aws-v4` | 3.4.0 | 3.5.0 | Signer configuration for canonical
URI encoding |
| `reqsign-aws-v4a` | 3.1.0 | 3.2.0 | Signer configuration for canonical
URI encoding |
| `reqsign-google` | 3.3.0 | 3.4.0 | Cloneable signer with a shared
OAuth2 token cache |
| `reqsign-huaweicloud-obs` | 3.0.8 | 3.1.0 | IAM agency credential
granter and credential expiry |
| `reqsign-oracle` | 3.0.8 | 3.1.0 | Signing caller-supplied request
body headers |
| `reqsign-tencent-cos` | 3.0.8 | 3.1.0 | STS `GetFederationToken`
granter |
| `reqsign-volcengine-tos` | 3.1.4 | 3.2.0 | STS `AssumeRole` granter
and credential expiry |

#954's SSO assume-role profile-chain resolution lands in the
`reqsign-aws-core` and `reqsign-aws-v4` minors above. The remaining
crates keep the patch bumps from #947, and the release remains `reqsign
0.20.9` with `reqsign-core 3.3.4`.

## Validation

- `cargo fmt --all -- --check` and strict workspace Clippy with all
targets and features.
- `cargo test --no-fail-fast`: 811 passed, 6 ignored.
- `cargo test --doc --workspace --all-features`: 76 passed, 6 ignored.
- `cargo semver-checks` against `v0.20.8`: the other 14 crates pass
patch-level checks. TOS and OBS report only
`constructible_struct_adds_field` for `Credential.expires_at`, the
intentional struct-literal break from #807 documented in each README
changelog.
- Supported WASM core/AWS checks.
- Release helper tests and `plan.py` version alignment; all 16 planned
versions are unpublished.
- `cargo publish --workspace --dry-run` for the complete 16-crate
publish plan.

## Existing MSRV limitation

A fresh downstream resolution with the facade's `full` feature on Rust
1.86 fails for both published `reqsign 0.20.8` and this branch:
`crypto-bigint 0.7.11` and `ctutils 0.4.8` require Rust 1.87. This is a
pre-existing dependency-resolution issue, not introduced by this
release.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
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.

Support assume-role profile chains backed by named SSO sessions

2 participants