Skip to content

Commit

Permalink
enhancement: hostname resolution (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
stobrien89 authored Nov 20, 2023
1 parent 06978bf commit f1bd5c0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changes/nextrelease/update-http-credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "enhancement",
"category": "Credentials",
"description": "Adds hostname resolution for the EcsCredentialProvider."
}
]
2 changes: 1 addition & 1 deletion src/Credentials/EcsCredentialProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private function isCompatibleUri($uri)
if ($host !== $ecsHost
&& $host !== $eksHost
&& $host !== self::EKS_SERVER_HOST_IPV6
&& !$this->isLoopbackAddress($host)
&& !$this->isLoopbackAddress(gethostbyname($host))
) {
return false;
}
Expand Down
28 changes: 28 additions & 0 deletions tests/Credentials/fixtures/ecs/uri-token-resolution.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,34 @@
}
}
},
{
"description": "http loopback(v4) with host resolution (no port)",
"env": {
"AWS_CONTAINER_CREDENTIALS_FULL_URI": "http://localhost/credentials"
},
"expect": {
"type": "success",
"request": {
"method": "GET",
"uri": "http://localhost/credentials",
"headers": {}
}
}
},
{
"description": "http loopback(v4) with host resolution (port)",
"env": {
"AWS_CONTAINER_CREDENTIALS_FULL_URI": "http://localhost:8080/credentials"
},
"expect": {
"type": "success",
"request": {
"method": "GET",
"uri": "http://localhost:8080/credentials",
"headers": {}
}
}
},
{
"description": "http loopback(v6) URI",
"env": {
Expand Down

0 comments on commit f1bd5c0

Please sign in to comment.