Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Log session-name and external-id when logging credentials (#447)
Browse files Browse the repository at this point in the history
* Log session-name and external-id when logging credentials
* Log the ARN and not the object
  • Loading branch information
stefansedich authored Dec 8, 2020
1 parent 72a7bb4 commit 7f7fd09
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/aws/sts/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@
package sts

import (
"strings"

log "github.com/sirupsen/logrus"
)

func CredentialsFields(identity *RoleIdentity, creds *Credentials) log.Fields {
return log.Fields{
fields := log.Fields{
"credentials.access.key": creds.AccessKeyId,
"credentials.expiration": creds.Expiration,
"credentials.role": identity.Role,
"credentials.role": identity.Role.ARN,
}

if identity.SessionName != "" {
fields["credentials.session-name"] = identity.SessionName
}

if identity.ExternalID != "" {
fields["credentials.external-id"] = strings.Repeat("*", len(identity.ExternalID))
}

return fields
}

0 comments on commit 7f7fd09

Please sign in to comment.