mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
44a8e10bfc
AWS recently launched a new version of the EC2 Instance Metadata Service, which is used to provide credentials to the awslogs driver when running on Amazon EC2. This new version of the IMDS adds defense-in-depth mechanisms against open firewalls, reverse proxies, and SSRF vulnerabilities and is generally an improvement over the previous version. An updated version of the AWS SDK is able to handle the both the previous version and the new version of the IMDS and functions when either is enabled. More information about IMDSv2 is available at the following links: * https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/ * https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html Closes https://github.com/moby/moby/issues/40422 Signed-off-by: Samuel Karp <skarp@amazon.com>
23 lines
453 B
Go
23 lines
453 B
Go
package sdkuri
|
|
|
|
import (
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
// PathJoin will join the elements of the path delimited by the "/"
|
|
// character. Similar to path.Join with the exception the trailing "/"
|
|
// character is preserved if present.
|
|
func PathJoin(elems ...string) string {
|
|
if len(elems) == 0 {
|
|
return ""
|
|
}
|
|
|
|
hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/")
|
|
str := path.Join(elems...)
|
|
if hasTrailing && str != "/" {
|
|
str += "/"
|
|
}
|
|
|
|
return str
|
|
}
|