Skip to content

Commit

Permalink
Merge pull request hashicorp#1837 from cleung2010/obfuscate-acl-token
Browse files Browse the repository at this point in the history
Obfuscate token for lookupACL error
  • Loading branch information
ryanuber authored Jul 5, 2016
2 parents 3db6395 + 912887a commit 104e1a5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion consul/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ func (c *aclCache) lookupACL(id, authDC string) (acl.ACL, error) {
if strings.Contains(err.Error(), aclNotFound) {
return nil, errors.New(aclNotFound)
} else {
c.logger.Printf("[ERR] consul.acl: Failed to get policy for '%s': %v", id, err)
s := id
// Print last 3 chars of the token if long enough, otherwise completly hide it
if len(s) > 3 {
s = fmt.Sprintf("token ending in '%s'", s[len(s)-3:])
} else {
s = redactedToken
}
c.logger.Printf("[ERR] consul.acl: Failed to get policy for %s: %v", s, err)
}

// Unable to refresh, apply the down policy
Expand Down

0 comments on commit 104e1a5

Please sign in to comment.