Skip to content

Commit

Permalink
Merge pull request #315 from synfinatic/dont-print-url
Browse files Browse the repository at this point in the history
No longer print AWS federated URL by default
  • Loading branch information
synfinatic authored Mar 25, 2022
2 parents 3624b90 + 0451be0 commit 2733384
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug Fixes

* No longer generate errors for empty History tag in cache #305
* No longer print the federated console url on errors by default #314

### New Features

Expand Down
7 changes: 6 additions & 1 deletion cmd/console_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"net/http"
"net/url"
"os/user"
"regexp"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
Expand Down Expand Up @@ -268,7 +269,11 @@ func openConsoleAccessKey(ctx *RunContext, creds *storage.RoleCredentials, durat

resp, err := http.Get(signin.GetUrl())
if err != nil {
return fmt.Errorf("Unable to login to AWS: %s", err.Error())
log.Debugf(err.Error())
// sanitize error and remove sensitive URL from normal output
r := regexp.MustCompile(`Get "[^"]+": `)
e := r.ReplaceAllString(err.Error(), "")
return fmt.Errorf("Unable to login to AWS: %s", e)
}

defer resp.Body.Close()
Expand Down

0 comments on commit 2733384

Please sign in to comment.