-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default credential loader doesn't seem to follow 301s from IMDSv2 #560
Comments
generally we don't follow 301s—I'll need to consult the spec and figure out if this behavior should be honored or not. Thanks for reporting, will follow up soon |
I followed up—I suspect the issue is not the 301—Other SDKs don't follow 301s for IMDS (and if they do it's a bug / security issue). The issue instead seems to be that we're hitting I don't see any particular reason we couldn't hit the URL with a trailing slash from the IMDS client though |
Thanks for the response! I can see why following 301s could be considered a security concern. uswitch/kiam#172 seems relevant. They switched to returning a 301 from a 308 thinking that clients would handle it better. uswitch/kiam#116 also seems relevant. I spun up an EC2 instance to try it out and both with and without
I'll leave it to you and others with more intimate knowledge of IMDSv2 but it does seem like having the client hit the endpoint with a trailing |
it seems like KIAM explicitly added this redirect for some internal reason: uswitch/kiam#121 |
PR: smithy-lang/smithy-rs#1487 |
Awesome, thanks for the quick review and quick fix @rcoh ! |
this shipped! |
|
Describe the bug
This is an indirect bug report from a user of Vector, which uses the AWS SDK.
When using the default credential chain, they see the loader reporting that it saw a 301, but it doesn't seem to automatically follow it, as I would expect.
The user is using KIAM to intercept the requests which is likely why the behavior differs from IMDSv2 generally.
See debug logs below.
Expected Behavior
The default credentials loader follows any observed 301s to fetch the IAM credentials.
Current Behavior
When a 301 is observed, it stops and bubbles up an error.
Reproduction Steps
Unfortunately I haven't observed this behavior myself, but we could ask the user for additional details if necessary.
Possible Solution
Default credential loader follows 301s from IMDSv2 API.
Additional Information/Context
User is running KIAM to intercept the metadata requests.
Vector issue: vectordotdev/vector#13211
Version
Environment details (OS name and version, etc.)
x86_64-unknown-linux-musl
Logs
The text was updated successfully, but these errors were encountered: