fix: STS AssumeRole returns empty credentials when endpoint has no path (#205) - #247
Conversation
…th (minio#205) Fixes issue minio#205: temporary credentials (access_key / secret_key / session_token) returned by AssumeRoleProvider are empty. Root cause: when the STS endpoint has no path (e.g. http://host:9000), the SigV4 signature is computed with an empty CanonicalURI, while the actual request is sent to '/', causing signature verification to fail and leaving credentials empty. Also aligns all STS provider request parameters with the minio-go reference implementation and fixes the XML root node paths used for credentials parsing. Bug fix (issue minio#205): - AssumeRoleProvider constructor: normalize an empty endpoint path to '/', keeping the signed CanonicalURI consistent with the actual request URI (conditional assignment only - does not override user-defined paths such as /minio/sts) - Add an AssumeRoleProvider() regression test: success path asserts all three temporary credential fields are non-empty; failure path asserts the error is diagnosable via creds.err Align STS provider parameters with minio-go: - Add token_revoke_type to every provider (AssumeRoleProvider, WebIdentityClientGrantsProvider/ClientGrantsProvider/WebIdentityProvider, LdapIdentityProvider, CertificateIdentityProvider), added to the request body only when non-empty - LdapIdentityProvider additionally gains policy, duration_seconds, and config_name - Jwt struct gains access_token / refresh_token; the WebIdentity flow now sends WebIdentityAccessToken / WebIdentityRefreshToken - All new parameters are appended at the end with defaults, backward compatible XML parsing fix: - All STS response parsing now uses the full root path with the Response prefix (e.g. AssumeRoleResponse/AssumeRoleResult), avoiding parse failures Files changed: include/miniocpp/providers.h, src/providers.cc, tests/tests.cc
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughProvider constructors now accept token-revocation settings and expanded LDAP options. Web identity providers forward JWT access and refresh tokens. STS response parsing uses qualified paths. A custom-token provider now fetches temporary credentials. An AssumeRole test validates returned credentials. ChangesProvider authentication updates
Estimated code review effort: 3 (Moderate) | ~30 minutes Mergeability Score: ⚪ Minimal · up to The PR corrects STS request URI/signature alignment and expands provider parameter and XML parsing compatibility; the only noted cleanup is a redundant test comment with no runtime impact, so no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Client
participant CustomTokenIdentityProvider
participant STSEndpoint
participant XMLParser
Client->>CustomTokenIdentityProvider: Request temporary credentials
CustomTokenIdentityProvider->>STSEndpoint: Send AssumeRoleWithCustomToken
STSEndpoint-->>CustomTokenIdentityProvider: Return response or request error
CustomTokenIdentityProvider->>XMLParser: Parse qualified credential XML
XMLParser-->>CustomTokenIdentityProvider: Return temporary credentials
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tests.cc`:
- Line 1571: Remove the redundant “Success path” comment immediately preceding
the temporary-credentials condition in the test, leaving the condition and
surrounding test logic unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 13f6a380-f180-40a3-a5ed-23846969d7fe
📒 Files selected for processing (3)
include/miniocpp/providers.hsrc/providers.cctests/tests.cc
add CustomTokenIdentityProvider
Fixes issue #205: temporary credentials (access_key / secret_key / session_token) returned by AssumeRoleProvider are empty. Root cause: when the STS endpoint has no path (e.g. http://host:9000), the SigV4 signature is computed with an empty CanonicalURI, while the actual request is sent to '/', causing signature verification to fail and leaving credentials empty.
Also aligns all STS provider request parameters with the minio-go reference implementation and fixes the XML root node paths used for credentials parsing.
Bug fix (issue #205):
Align STS provider parameters with minio-go:
XML parsing fix:
Files changed: include/miniocpp/providers.h, src/providers.cc, tests/tests.cc
Summary by CodeRabbit
New Features
Bug Fixes