Skip to content

Commit 84fbf86

Browse files
authored
fix(image): use standardized HTTP client for ECR authentication (#9322)
1 parent 04abb78 commit 84fbf86

File tree

1 file changed

+7
-1
lines changed
  • pkg/fanal/image/registry/ecr

1 file changed

+7
-1
lines changed

pkg/fanal/image/registry/ecr/ecr.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/aquasecurity/trivy/pkg/fanal/image/registry/intf"
1616
"github.com/aquasecurity/trivy/pkg/fanal/types"
1717
"github.com/aquasecurity/trivy/pkg/log"
18+
xhttp "github.com/aquasecurity/trivy/pkg/x/http"
1819
)
1920

2021
type ecrAPI interface {
@@ -37,10 +38,15 @@ func getSession(domain, region string, option types.RegistryOptions) (aws.Config
3738
return config.LoadDefaultConfig(
3839
context.TODO(),
3940
config.WithRegion(region),
41+
config.WithHTTPClient(xhttp.Client()),
4042
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(option.AWSAccessKey, option.AWSSecretKey, option.AWSSessionToken)),
4143
)
4244
}
43-
return config.LoadDefaultConfig(context.TODO(), config.WithRegion(region))
45+
return config.LoadDefaultConfig(
46+
context.TODO(),
47+
config.WithRegion(region),
48+
config.WithHTTPClient(xhttp.Client()),
49+
)
4450
}
4551

4652
func (e *ECR) CheckOptions(domain string, option types.RegistryOptions) (intf.RegistryClient, error) {

0 commit comments

Comments
 (0)