From 165f143e2c3088e210a450d16d33eaa5e6017072 Mon Sep 17 00:00:00 2001 From: sviik Date: Fri, 8 Dec 2023 13:48:58 +0200 Subject: [PATCH] Prune access tokens in "connected to" logs 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. --- assets/js/phoenix/socket.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/phoenix/socket.js b/assets/js/phoenix/socket.js index 48de25649d..32e4b030db 100644 --- a/assets/js/phoenix/socket.js +++ b/assets/js/phoenix/socket.js @@ -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()