Skip to content

feat(huaweicloud-obs): add IAM agency credential granter - #964

Merged
Xuanwo merged 4 commits into
mainfrom
xuanwo/obs-agency-credential-expiry
Nov 19, 2026
Merged

Xuanwo merged 4 commits into
mainfrom
xuanwo/obs-agency-credential-expiry

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Implements #963. Part of #807.

Problem

OBS could sign with temporary Huawei Cloud credentials but had no service-local GrantCredential path for IAM agency issuance, and its Credential could not retain the issued expiration. Without the authoritative expires_at, a granted credential could be used past its real lifetime, particularly when presigning.

Behavior

  • Credential now carries expires_at: Option<Timestamp>. Credential::new keeps its original three-argument, no-expiry behavior; with_expires_at covers the known-expiry path. Existing struct-literal callers must switch to the constructors, as noted in the service changelog.
  • AgencyGrant binds the IAM agency and delegating domain. AgencyGranter signs POST /v3.0/OS-CREDENTIAL/securitytokens with SDK-HMAC-SHA256, accepts permanent and temporary source credentials with X-Security-Token, validates the documented 900–86400 second duration, and returns the existing Credential with the exact IAM expires_at.
  • Invalid or expired source credentials fail before I/O. Expired outputs fail after I/O. HTTP and parse errors do not echo response bodies or credential material, and granted output is never cached.
  • Known-expiry credentials are rejected by OBS header signing and presigning when they do not cover the operation deadline.

No policy, session-user input, default-chain insertion, or cross-service authorization model is added.

Validation

  • cargo test -p reqsign-huaweicloud-obs
  • cargo test --no-fail-fast (workspace)
  • cargo test --doc -p reqsign-huaweicloud-obs --all-features
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo check -p reqsign-huaweicloud-obs --target wasm32-unknown-unknown
  • cargo fmt --all -- --check
  • hawkeye check

Tests use fixed clocks, synthetic keys, and an injected mock HttpSend; they cover exact request bytes and a golden SDK signature, the official Go SDK signing vector, source and duration validation, terminal error redaction, post-I/O expiry, and reuse of the issued credential through Signer. No cloud calls or real credentials are used.

The OBS signing-diagnostic redaction from #960 is merged into main and integrated in this head; this change does not modify sign_request.rs.

Implements the Huawei Cloud OBS increment tracked by #807 / #963.

AgencyGrant binds an IAM agency and delegating domain. AgencyGranter signs
the assume_role request with SDK-HMAC-SHA256, accepts permanent and temporary
source credentials, and returns the existing OBS Credential with the exact IAM
expires_at.

Credential now stores absolute expiration and checks it in is_valid_at, so the
existing OBS signer bounds header signing and presigning. Existing constructors
keep their no-expiry behavior.

Synthetic tests cover the exact request and signature, the official SDK signing
vector, source and duration validation, redacted terminal errors, post-I/O
expiry, and reuse of the issued credential through Signer.
@Xuanwo
Xuanwo merged commit 0f76a25 into main Nov 19, 2026
59 of 60 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/obs-agency-credential-expiry branch November 19, 2026 14:27
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.

2 participants