Repository navigation
feat(tencent-cos): add STS GetFederationToken granter - #955
Merged
Merged
Conversation
Part of #807. Adds GetFederationTokenGrant and GetFederationTokenGranter for Tencent Cloud STS. The granter consumes a permanent source credential, signs a TC3-HMAC-SHA256 GetFederationToken request with the caller-supplied Name and CAM Policy, and returns the existing COS Credential with the exact ExpiredTime epoch expiration. expires_in maps to DurationSeconds; granted output is never cached. Tests cover the exact request fields, TC3 signature, permanent-source and duration validation, post-I/O expiration, error and Debug redaction, and consumption by the existing COS signer. The granter is isolated from the web-identity provider and default credential chain.
PsiACE
approved these changes
Nov 19, 2026
URL-encode the raw CAM policy exactly once in the Policy wire field and sign the actual serialized request. Validate the documented ASCII-letter Name constraint and align the example and tests. Add offline coverage for literal reserved characters, policy round-trip, invalid names, and the COS signer lifetime mismatch: the API default 1800-second grant cannot cover the signer's default 3600-second header lifetime, while a 7200-second grant can and a shorter explicit lifetime selects query signing.
12 tasks done
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.
Implements the Tencent Cloud STS
GetFederationTokenitem in #807. Part of #807; this does not close the tracker.GetFederationTokenGrantbinds the caller-suppliedNameand raw CAMPolicy.Nameis validated as ASCII letters only.Policyis URL-encoded exactly once in the wire field before the request is serialized and signed.GetFederationTokenGranterconsumes the source throughGranter, signs the Tencent Cloud API 3.0 request withTC3-HMAC-SHA256, and returns the existingCredentialwith the responseExpiredTimeas an exact epoch expiration.expires_inmaps toDurationSeconds;Noneomits it and uses the service default. The API only accepts permanent keys, so a source with a security token or expiration is rejected before I/O, as is an invalid duration or grant. Granted output is never cached.The service default of 1800 seconds is shorter than the COS signer's default 3600-second header-signing lifetime. Tests cover that mismatch and a 7200-second grant that the existing signer accepts with its default settings; the signer's lifetime checks and defaults are unchanged. The granter is isolated from
AssumeRoleWithWebIdentityCredentialProviderand the default credential chain. No core abstraction, default-provider behavior, or permissions defaults change.Testing uses a synthetic source credential and a local mock
HttpSend: exact request fields and a golden TC3 signature over the encoded policy; literal reserved characters and policy round-trip; source, duration, and name/grant validation before I/O; post-I/O expiration; API and non-200 error redaction; and consumption by the existing COSRequestSigner. Live-service coverage remains separate under #825.Validation:
cargo test -p reqsign-tencent-cos,cargo clippy -p reqsign-tencent-cos --all-targets -- -D warnings,cargo check -p reqsign-tencent-cos --target wasm32-unknown-unknown, andhawkeye checkpass locally.