From 8744c794936db6b7b54eda49cdbb98270d8b598f Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Tue, 31 Oct 2023 05:11:33 -0400 Subject: [PATCH] Strip username from uploaded logs --- src/back/responses.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/back/responses.ts b/src/back/responses.ts index c6b15edd0..13bce81f5 100644 --- a/src/back/responses.ts +++ b/src/back/responses.ts @@ -1780,8 +1780,14 @@ export function registerRequestCallbacks(state: BackState, init: () => Promise { + // Filter entries + const username = os.userInfo().username; + const entries = state.log.filter(e => e !== undefined).map(e => { + e.content = e.content.replace(new RegExp('([/\\\\])' + username, 'g'), '$1***'); + return e; + }); + // Upload to log server - const entries = state.log.filter(e => e !== undefined); const postUrl = url.resolve(state.config.logsBaseUrl, 'logdata'); // Server responds with log id e.g ABC123 const res = await axios.post(postUrl, { entries: entries });