Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: actions/checkout@v3
go-version-file: 'go.mod'
- name: Run tests
run: go test -race ./...
lint:
Expand All @@ -31,11 +31,11 @@ jobs:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: actions/checkout@v3
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.4.0
uses: golangci/golangci-lint-action@v6.5.1
with:
version: v1.52.0
version: v1.64.8
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Release

on:
push:
tags:
- "v*.*.*"

jobs:
release:
name: Build and Release Binary
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"

- name: Extract Version from Tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Build Binary
run: |
go build -ldflags "-X main.Version=kosli-dev-${VERSION}" -o aws-vault .

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: aws-vault
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: "Automated release of version ${{ github.ref_name }}"
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
permissions:
issues: write
steps:
- uses: actions/stale@v7
- uses: actions/stale@v9
with:
days-before-stale: 180
days-before-close: 7
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ linters:
- errchkjson
- errname
- exhaustive
- exportloopref
- copyloopvar
- gofmt
- goimports
- makezero
Expand Down
3 changes: 2 additions & 1 deletion cli/add.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"fmt"
"log"
Expand Down Expand Up @@ -34,7 +35,7 @@ func ConfigureAddCommand(app *kingpin.Application, a *AwsVault) {
Default("true").
BoolVar(&input.AddConfig)

cmd.Action(func(c *kingpin.ParseContext) error {
cmd.Action(func(_ *kingpin.ParseContext) error {
keyring, err := a.Keyring()
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cli/add_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"log"
"os"
Expand Down
3 changes: 2 additions & 1 deletion cli/clear.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"fmt"

Expand All @@ -21,7 +22,7 @@ func ConfigureClearCommand(app *kingpin.Application, a *AwsVault) {
HintAction(a.MustGetProfileNames).
StringVar(&input.ProfileName)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
keyring, err := a.Keyring()
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cli/exec.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"context"
"fmt"
Expand Down Expand Up @@ -118,7 +119,7 @@ func ConfigureExecCommand(app *kingpin.Application, a *AwsVault) {
cmd.Arg("args", "Command arguments").
StringsVar(&input.Args)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
input.Config.MfaPromptMethod = a.PromptDriver(hasBackgroundServer(input))
input.Config.NonChainedGetSessionTokenDuration = input.SessionDuration
input.Config.AssumeRoleDuration = input.SessionDuration
Expand Down
1 change: 1 addition & 0 deletions cli/exec_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"github.com/alecthomas/kingpin/v2"

Expand Down
15 changes: 10 additions & 5 deletions cli/export.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"context"
"encoding/json"
Expand Down Expand Up @@ -64,7 +65,7 @@ func ConfigureExportCommand(app *kingpin.Application, a *AwsVault) {
HintAction(a.MustGetProfileNames).
StringVar(&input.ProfileName)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
input.Config.MfaPromptMethod = a.PromptDriver(false)
input.Config.NonChainedGetSessionTokenDuration = input.SessionDuration
input.Config.AssumeRoleDuration = input.SessionDuration
Expand Down Expand Up @@ -103,13 +104,17 @@ func ExportCommand(input ExportCommandInput, f *vault.ConfigFile, keyring keyrin

if input.Format == FormatTypeExportJSON {
return printJSON(input, credsProvider)
} else if input.Format == FormatTypeExportINI {
}

if input.Format == FormatTypeExportINI {
return printINI(credsProvider, input.ProfileName, config.Region)
} else if input.Format == FormatTypeExportEnv {
}

if input.Format == FormatTypeExportEnv {
return printEnv(input, credsProvider, config.Region, "export ")
} else {
return printEnv(input, credsProvider, config.Region, "")
}

return printEnv(input, credsProvider, config.Region, "")
}

func printJSON(input ExportCommandInput, credsProvider aws.CredentialsProvider) error {
Expand Down
1 change: 1 addition & 0 deletions cli/export_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"github.com/alecthomas/kingpin/v2"

Expand Down
5 changes: 3 additions & 2 deletions cli/global.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"fmt"
"io"
Expand Down Expand Up @@ -118,7 +119,7 @@ func ConfigureGlobals(app *kingpin.Application) *AwsVault {
Envar("AWS_VAULT_PROMPT").
StringVar(&a.promptDriver)

app.Validate(func(app *kingpin.Application) error {
app.Validate(func(_ *kingpin.Application) error {
if a.promptDriver == "" {
return nil
}
Expand Down Expand Up @@ -162,7 +163,7 @@ func ConfigureGlobals(app *kingpin.Application) *AwsVault {
Envar("AWS_VAULT_FILE_DIR").
StringVar(&a.KeyringConfig.FileDir)

app.PreAction(func(c *kingpin.ParseContext) error {
app.PreAction(func(_ *kingpin.ParseContext) error {
if !a.Debug {
log.SetOutput(io.Discard)
}
Expand Down
3 changes: 2 additions & 1 deletion cli/list.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"fmt"
"os"
Expand Down Expand Up @@ -33,7 +34,7 @@ func ConfigureListCommand(app *kingpin.Application, a *AwsVault) {
cmd.Flag("credentials", "Show only the profiles with stored credential").
BoolVar(&input.OnlyCredentials)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
keyring, err := a.Keyring()
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cli/list_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"github.com/alecthomas/kingpin/v2"

Expand Down
3 changes: 2 additions & 1 deletion cli/login.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"context"
"encoding/json"
Expand Down Expand Up @@ -61,7 +62,7 @@ func ConfigureLoginCommand(app *kingpin.Application, a *AwsVault) {
HintAction(a.MustGetProfileNames).
StringVar(&input.ProfileName)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
input.Config.MfaPromptMethod = a.PromptDriver(false)
input.Config.NonChainedGetSessionTokenDuration = input.SessionDuration
input.Config.AssumeRoleDuration = input.SessionDuration
Expand Down
1 change: 1 addition & 0 deletions cli/proxy.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"os"
"os/signal"
Expand Down
3 changes: 2 additions & 1 deletion cli/remove.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"fmt"
"strings"
Expand Down Expand Up @@ -36,7 +37,7 @@ func ConfigureRemoveCommand(app *kingpin.Application, a *AwsVault) {
Short('f').
BoolVar(&input.Force)

cmd.Action(func(c *kingpin.ParseContext) error {
cmd.Action(func(_ *kingpin.ParseContext) error {
keyring, err := a.Keyring()
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cli/rotate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cli

// nolint:depguard
import (
"context"
"fmt"
Expand Down Expand Up @@ -33,7 +34,7 @@ func ConfigureRotateCommand(app *kingpin.Application, a *AwsVault) {
HintAction(a.MustGetProfileNames).
StringVar(&input.ProfileName)

cmd.Action(func(c *kingpin.ParseContext) (err error) {
cmd.Action(func(_ *kingpin.ParseContext) (err error) {
input.Config.MfaPromptMethod = a.PromptDriver(false)
keyring, err := a.Keyring()
if err != nil {
Expand Down
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module github.com/99designs/aws-vault/v7

go 1.20
go 1.23

require (
github.com/99designs/keyring v1.2.2
github.com/alecthomas/kingpin/v2 v2.3.2
github.com/aws/aws-sdk-go-v2 v1.17.7
github.com/aws/aws-sdk-go-v2/config v1.18.19
github.com/aws/aws-sdk-go-v2/credentials v1.13.18
github.com/aws/aws-sdk-go-v2/service/iam v1.19.8
github.com/aws/aws-sdk-go-v2/service/sso v1.12.6
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6
github.com/aws/aws-sdk-go-v2/service/sts v1.18.7
github.com/aws/aws-sdk-go-v2 v1.36.0
github.com/aws/aws-sdk-go-v2/config v1.27.9
github.com/aws/aws-sdk-go-v2/credentials v1.17.9
github.com/aws/aws-sdk-go-v2/service/iam v1.39.0
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5
github.com/google/go-cmp v0.5.9
github.com/mattn/go-isatty v0.0.18
github.com/mattn/go-tty v0.0.4
Expand All @@ -23,12 +23,13 @@ require (
require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect
github.com/aws/smithy-go v1.22.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
Expand Down
Loading