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

refactor: Validate AWS Metadata URLs #1486

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

danielbankhead
Copy link
Member

Notes:

  • Validates a URL's hostname rather than host
    • Important for URLs with ports
  • Added test for URL with port
  • Uses static variables for AWS metadata IP Addresses
  • RangeError rather than Error
  • Separated validators from setters in constructor

Notes:
- Validates a URL's `hostname` rather than`host`
- Added test for URL with port
- Uses static variables for AWS metadata IP Addresses
- `RangeError` rather than `Error`
- Separated validators from setters in `constructor`
@danielbankhead danielbankhead requested review from a team as code owners November 8, 2022 01:19
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Nov 8, 2022
it('should support credential_source with a port number', () => {
const validCredentialSource = {...awsCredentialSource};
const validURLWithPort = new URL(validCredentialSource.url);
validURLWithPort.port = '8888';
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not able to find any official aws documentatiton that says what ports are allowed. @lsirac any idea?

Copy link
Member Author

@danielbankhead danielbankhead Nov 8, 2022

Choose a reason for hiding this comment

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

I didn't see anything either; perhaps we can verify the hostname for now and if customers set a port we can allow it for now?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that works 👍

@danielbankhead danielbankhead merged commit 515441f into main Nov 8, 2022
@danielbankhead danielbankhead deleted the refactor-validate-aws-metadata-urls branch November 8, 2022 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants