Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

refactor: Validate AWS Metadata URLs#1486

Merged
danielbankhead merged 1 commit intomainfrom
refactor-validate-aws-metadata-urls
Nov 8, 2022
Merged

refactor: Validate AWS Metadata URLs#1486
danielbankhead merged 1 commit intomainfrom
refactor-validate-aws-metadata-urls

Conversation

@danielbankhead
Copy link
Copy Markdown
Contributor

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 a review from a team as a code owner November 8, 2022 01:19
@danielbankhead danielbankhead requested a review from a team 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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 👍

@sai-sunder-s sai-sunder-s requested a review from lsirac November 8, 2022 06:02
@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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants