-
Notifications
You must be signed in to change notification settings - Fork 906
Add option to disable EC2 metadata (IMDS) calls without token #4866
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
Merged
Conversation
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
millems
reviewed
Jan 31, 2024
...main/java/software/amazon/awssdk/auth/credentials/internal/Ec2MetadataDisableV1Resolver.java
Outdated
Show resolved
Hide resolved
...main/java/software/amazon/awssdk/auth/credentials/internal/Ec2MetadataDisableV1Resolver.java
Show resolved
Hide resolved
...main/java/software/amazon/awssdk/auth/credentials/internal/Ec2MetadataDisableV1Resolver.java
Outdated
Show resolved
Hide resolved
zoewangg
reviewed
Jan 31, 2024
...rc/main/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProvider.java
Show resolved
Hide resolved
core/regions/src/main/java/software/amazon/awssdk/regions/internal/util/EC2MetadataUtils.java
Outdated
Show resolved
Hide resolved
zoewangg
reviewed
Feb 1, 2024
...rc/main/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProvider.java
Outdated
Show resolved
Hide resolved
...regions/src/test/java/software/amazon/awssdk/regions/internal/util/EC2MetadataUtilsTest.java
Outdated
Show resolved
Hide resolved
...regions/src/test/java/software/amazon/awssdk/regions/internal/util/EC2MetadataUtilsTest.java
Outdated
Show resolved
Hide resolved
...main/java/software/amazon/awssdk/auth/credentials/internal/Ec2MetadataDisableV1Resolver.java
Show resolved
Hide resolved
zoewangg
approved these changes
Feb 1, 2024
|
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.
Motivation and Context
Currently, when the SDK calls the EC2 Instance Metadata Service (IMDS) to fetch regional or credential information, it attempts to fetch a token which is then attached to the credentials call, for security. If token fetching fails due to some errors (403, 404, 405) or timeouts, the provider makes an unsecure call without the token header.
It's recommended to avoid fallback to unsecure, IMDS v1 style calls without a token and this PR adds a configuration option to facilitate that.
Modifications
AWS_EC2_METADATA_V1_DISABLED
)aws.disableEc2MetadataV1
)ec2_metadata_v1_disabled
).InstanceProfileCredentialsProvider
InstanceProfileRegionProvider
(specifically,EC2MetadataUtils
)Note that all changes except for the ones to
InstanceProfileRegionProvider
are reviewed in #4840.Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License