From 3f2231e0ab0b855267e1621ecd1ef7da09ef4472 Mon Sep 17 00:00:00 2001 From: Steven Martin Date: Fri, 22 Nov 2024 06:06:08 -0500 Subject: [PATCH] [web] update user participants for k8s non-interactive in recorded sessions (#49345) --- .../teleport/src/services/recordings/makeRecording.ts | 7 ++++++- .../teleport/src/services/recordings/recordings.test.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/packages/teleport/src/services/recordings/makeRecording.ts b/web/packages/teleport/src/services/recordings/makeRecording.ts index c26af2e426ced..961d9bd1456ef 100644 --- a/web/packages/teleport/src/services/recordings/makeRecording.ts +++ b/web/packages/teleport/src/services/recordings/makeRecording.ts @@ -62,6 +62,7 @@ function makeDesktopRecording({ function makeSshOrKubeRecording({ participants, + user, time, session_start, session_stop, @@ -80,9 +81,13 @@ function makeSshOrKubeRecording({ ); let hostname = server_hostname || 'N/A'; + // SSH interactive/non-interactive and k8s interactive sessions user participants are in the participants field. + let userParticipants = participants; // For Kubernetes sessions, put the full pod name as 'hostname'. if (proto === 'kube') { hostname = `${kubernetes_cluster}/${kubernetes_pod_namespace}/${kubernetes_pod_name}`; + // For non-interactive k8s sessions the participant is the Teleport user running the command + if (!interactive) userParticipants = [user]; } // Description set to play for interactive so users can search by "play". @@ -97,7 +102,7 @@ function makeSshOrKubeRecording({ durationText, sid, createdDate: time, - users: participants ? participants.join(', ') : [], + users: userParticipants ? userParticipants.join(', ') : [], hostname, description, recordingType: kubernetes_cluster ? 'k8s' : 'ssh', diff --git a/web/packages/teleport/src/services/recordings/recordings.test.ts b/web/packages/teleport/src/services/recordings/recordings.test.ts index c7f61f7657a66..bc05ac64a1f9c 100644 --- a/web/packages/teleport/src/services/recordings/recordings.test.ts +++ b/web/packages/teleport/src/services/recordings/recordings.test.ts @@ -51,7 +51,7 @@ test('fetch session recordings, response formatting', async () => { playable: false, recordingType: 'k8s', sid: '456b933c-4ec4-59f1-862c-90ca9f7648b1', - users: [], + users: 'onuweeme@wiuke.mh', }, ], startKey: '',