Skip to content

Commit

Permalink
Prune access tokens in "connected to" logs
Browse files Browse the repository at this point in the history
ENG-482

When a connection is opened, then a message is logged with endpoint
URL which contains access token. Prune the access token part of the URL.
  • Loading branch information
sviik committed Dec 11, 2023
1 parent 1c8156a commit 165f143
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/js/phoenix/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ export default class Socket {
}

onConnOpen(){
if(this.hasLogger()) this.log("transport", `connected to ${this.endPointURL()}`)
if(this.hasLogger()) {
const endPointURL = this.endPointURL()
const prunedURL = endPointURL.replace(/access_token=([^&#/]+)/, 'access_token=-pruned-')
this.log("transport", `connected to ${prunedURL}`)
}
this.closeWasClean = false
this.establishedConnections++
this.flushSendBuffer()
Expand Down

0 comments on commit 165f143

Please sign in to comment.