Skip to content
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

feat: add option to make IMDSv1 fallback optional #2810

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

yenfryherrerafeliz
Copy link
Contributor

Right now IMDSv1 fallback is enabled by default, but this implementation allows customer to decided whether or not they want this behavior when using the InstanceProfileProvider. Here is how this can be set:

  • Explicit configuration: $provider = new InstanceProfileProvider(['ec2_metadata_v1_disabled' => true|false]);
  • Environment variable: AWS_EC2_METADATA_V1_DISABLED set to true or false
  • Config file. Example: [default] ec2_metadata_v1_disabled=true|false

Description of changes:
Add a function that resolves for whether or not we should fallback to IMDSv1.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Member

@SamRemis SamRemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! Just a few changes we should make

src/Credentials/InstanceProfileProvider.php Show resolved Hide resolved
src/Credentials/InstanceProfileProvider.php Show resolved Hide resolved
src/Credentials/InstanceProfileProvider.php Outdated Show resolved Hide resolved
Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more things, but I think we're close.

src/Credentials/InstanceProfileProvider.php Outdated Show resolved Hide resolved
src/Credentials/InstanceProfileProvider.php Show resolved Hide resolved
tests/Credentials/InstanceProfileProviderTest.php Outdated Show resolved Hide resolved
Right now IMDSv1 fallback is enabled by default, but this implementation allows customer to decided whether or not they want this behavior when using the InstanceProfileProvider.
Here is how this can be set:
- Explicit configuration:
  $provider = new InstanceProfileProvider(['ec2_metadata_v1_disabled' => true|false]);
- Environment variable: AWS_EC2_METADATA_V1_DISABLED set to true or false
- Config file. Example:
  [default]
  ec2_metadata_v1_disabled=true|false
updating namespace
@stobrien89 stobrien89 merged commit 44d2e8d into aws:master Nov 13, 2023
15 checks passed
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.

3 participants