From 3d10b62ae585cc0a9ccd222e3f613dd261c4c272 Mon Sep 17 00:00:00 2001 From: Guy Rozendorn Date: Tue, 3 Aug 2021 22:11:25 +0300 Subject: [PATCH 1/2] add support for session token --- cli/add.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/add.go b/cli/add.go index 67adca542..fd1b57479 100644 --- a/cli/add.go +++ b/cli/add.go @@ -50,7 +50,7 @@ func ConfigureAddCommand(app *kingpin.Application, a *AwsVault) { } func AddCommand(input AddCommandInput, keyring keyring.Keyring, awsConfigFile *vault.ConfigFile) error { - var accessKeyId, secretKey string + var accessKeyId, secretKey, sessionToken string p, _ := awsConfigFile.ProfileSection(input.ProfileName) if p.SourceProfile != "" { @@ -65,6 +65,9 @@ func AddCommand(input AddCommandInput, keyring keyring.Keyring, awsConfigFile *v if secretKey = os.Getenv("AWS_SECRET_ACCESS_KEY"); secretKey == "" { return fmt.Errorf("Missing value for AWS_SECRET_ACCESS_KEY") } + if sessionToken = os.Getenv("AWS_SESSION_TOKEN"); sessionToken == "" { + return fmt.Errorf("Missing value for AWS_SESSION_TOKEN") + } } else { var err error if accessKeyId, err = prompt.TerminalPrompt("Enter Access Key ID: "); err != nil { @@ -75,7 +78,7 @@ func AddCommand(input AddCommandInput, keyring keyring.Keyring, awsConfigFile *v } } - creds := aws.Credentials{AccessKeyID: accessKeyId, SecretAccessKey: secretKey} + creds := aws.Credentials{AccessKeyID: accessKeyId, SecretAccessKey: secretKey, SessionToken: sessionToken} ckr := &vault.CredentialKeyring{Keyring: keyring} if err := ckr.Set(input.ProfileName, creds); err != nil { From 258b1d6041646d2496893b6516fe9aa0551e5d39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Aug 2022 01:32:35 +0000 Subject: [PATCH 2/2] Bump gopkg.in/ini.v1 from 1.66.3 to 1.67.0 Bumps [gopkg.in/ini.v1](https://github.com/go-ini/ini) from 1.66.3 to 1.67.0. - [Release notes](https://github.com/go-ini/ini/releases) - [Commits](https://github.com/go-ini/ini/compare/v1.66.3...v1.67.0) --- updated-dependencies: - dependency-name: gopkg.in/ini.v1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 324c796da..40fe3bcbc 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 - gopkg.in/ini.v1 v1.66.3 + gopkg.in/ini.v1 v1.67.0 ) require ( diff --git a/go.sum b/go.sum index 109aa656a..fc600fa39 100644 --- a/go.sum +++ b/go.sum @@ -82,8 +82,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.66.3 h1:jRskFVxYaMGAMUbN0UZ7niA9gzL9B49DOqE78vg0k3w= -gopkg.in/ini.v1 v1.66.3/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=