Skip to content

Commit bb40314

Browse files
authored
Throw an error if aws session token is detected (#842)
1 parent ae25f18 commit bb40314

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cli/cmd/lib_aws_creds.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ func readAWSCredsFromConfigFile(awsCreds *AWSCredentials, path string) error {
113113
// awsCreds is what was read from the cluster config YAML
114114
func setInstallAWSCredentials(awsCreds *AWSCredentials) error {
115115
// First check env vars
116+
if os.Getenv("AWS_SESSION_TOKEN") != "" {
117+
fmt.Println("warning: credentials requiring aws session tokens are not supported")
118+
}
119+
116120
if os.Getenv("AWS_ACCESS_KEY_ID") != "" && os.Getenv("AWS_SECRET_ACCESS_KEY") != "" {
117121
awsCreds.AWSAccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID")
118122
awsCreds.AWSSecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY")

pkg/lib/aws/credentials.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package aws
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/aws/aws-sdk-go/aws/credentials"
2123
)
2224

@@ -31,6 +33,10 @@ func GetCredentialsFromCLIConfigFile() (string, string, error) {
3133
return "", "", err
3234
}
3335

36+
if value.SessionToken != "" {
37+
fmt.Println("warning: credentials requiring aws session tokens are not supported")
38+
}
39+
3440
if value.AccessKeyID == "" || value.SecretAccessKey == "" {
3541
return "", "", ErrorReadCredentials()
3642
}

0 commit comments

Comments
 (0)