google/internal/external: Adding metadata verification

This commit is contained in:
Ryan Kohler
2022-11-17 13:51:47 -08:00
parent 68a41d64f9
commit 74bcc33f5e
3 changed files with 286 additions and 28 deletions

View File

@@ -213,6 +213,10 @@ func (c *Config) parse(ctx context.Context) (baseCredentialSource, error) {
awsCredSource.IMDSv2SessionTokenURL = c.CredentialSource.IMDSv2SessionTokenURL
}
if err := awsCredSource.validateMetadataServers(); err != nil {
return nil, err
}
return awsCredSource, nil
}
} else if c.CredentialSource.File != "" {