Skip to content

Commit

Permalink
Don't log websocket messages if there are errors.
Browse files Browse the repository at this point in the history
The messages that come over the websockets can potentially contain sensitive
information that shouldn't be put in logs. Separately, if reading the message
results in an error, the content of the message is irrelevant and unreliable.
  • Loading branch information
Justin Haynes committed Sep 29, 2017
1 parent 62f3de1 commit 64d10d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion agent/acs/handler/acs_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (acsSession *session) Start() error {
// Disconnected unexpectedly from ACS, compute backoff duration to
// reconnect
reconnectDelay := acsSession.computeReconnectDelay(isInactiveInstance)
seelog.Debugf("Reconnecting to ACS in: %v", reconnectDelay)
seelog.Infof("Reconnecting to ACS in: %s", reconnectDelay.String())
waitComplete := acsSession.waitForDuration(reconnectDelay)
if waitComplete {
// If the context was not cancelled and we've waited for the
Expand Down
10 changes: 5 additions & 5 deletions agent/wsclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (cs *ClientServerImpl) ConsumeMessages() error {

default:
// Unexpected error occurred
seelog.Errorf("Error getting message from ws backend: error: [%v], message: [%s], messageType: [%v] ", err, message, messageType)
seelog.Errorf("Error getting message from ws backend: error: [%v], messageType: [%v] ", err, messageType)
return err
}

Expand Down Expand Up @@ -413,8 +413,8 @@ func websocketScheme(httpScheme string) (string, error) {
// See https://github.com/gorilla/websocket/blob/87f6f6a22ebfbc3f89b9ccdc7fddd1b914c095f9/conn.go#L650
func permissibleCloseCode(err error) bool {
return websocket.IsCloseError(err,
websocket.CloseNormalClosure,
websocket.CloseAbnormalClosure,
websocket.CloseGoingAway,
websocket.CloseInternalServerErr)
websocket.CloseNormalClosure, // websocket error code 1000
websocket.CloseAbnormalClosure, // websocket error code 1006
websocket.CloseGoingAway, // websocket error code 1001
websocket.CloseInternalServerErr) // websocket error code 1011
}

0 comments on commit 64d10d8

Please sign in to comment.