Skip to content

fix: session trackers participants inconsistencies#58853

Merged
tigrato merged 2 commits intomasterfrom
tigrato/session-tracker-suers
Sep 8, 2025
Merged

fix: session trackers participants inconsistencies#58853
tigrato merged 2 commits intomasterfrom
tigrato/session-tracker-suers

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Sep 8, 2025

This PR fixes some inconsistencies in session trackers' participants across different protocols. Some protocols set the real username when dealing with leaf clusters' sessions, while others, such as kube, set the field to the transformed username - remote-{user}-{cluster}.

This is a problem because when performing RBAC against the session tracker - contains(session_tracker.participants, user.metadata.name) - the root user in the leaf cluster could see it depending on the protocol he used because the authorizer uses the transformed username.

This PR aligns all session trackers by adding a extra field Cluster that carries the origin user's cluster and change the username to use the real username instead of transformed.

The usernames are transformed before applying the session tracker RBAC.

@tigrato tigrato requested review from rosstimothy and zmb3 September 8, 2025 09:36
@tigrato tigrato added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v18 labels Sep 8, 2025
This PR fixes some inconsistencies in session trackers' participants
across different protocols. Some protocols set the real username when
dealing with leaf clusters' sessions, while others, such as kube, set
the field to the transformed username - `remote-{user}-{cluster}`.

This is a problem because when performing RBAC against the session
tracker - `contains(session_tracker.participants, user.metadata.name)` -
the root user in the leaf cluster could see it depending on the protocol he used
because the authorizer uses the transformed username.

This PR aligns all session trackers by adding a extra field `Cluster`
that carries the origin user's cluster and change the username to use
the real username instead of transformed.

The usernames are transformed before applying the session tracker RBAC.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@tigrato tigrato force-pushed the tigrato/session-tracker-suers branch from 0c31b54 to d43ecc1 Compare September 8, 2025 09:56
tigrato added a commit that referenced this pull request Sep 8, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@tigrato tigrato marked this pull request as ready for review September 8, 2025 10:14
@github-actions github-actions bot added application-access audit-log Issues related to Teleports Audit Log database-access Database access related issues and PRs desktop-access labels Sep 8, 2025
Comment thread api/types/session_tracker_test.go Outdated
Comment thread lib/auth/auth_with_roles.go Outdated
@tigrato tigrato added this pull request to the merge queue Sep 8, 2025
Merged via the queue into master with commit 583823f Sep 8, 2025
44 of 45 checks passed
@tigrato tigrato deleted the tigrato/session-tracker-suers branch September 8, 2025 16:30
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@tigrato See the table below for backport results.

Branch Result
branch/v18 Failed

tigrato added a commit that referenced this pull request Sep 8, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
tigrato added a commit that referenced this pull request Sep 8, 2025
* fix: session trackers participants inconsistencies

This PR fixes some inconsistencies in session trackers' participants
across different protocols. Some protocols set the real username when
dealing with leaf clusters' sessions, while others, such as kube, set
the field to the transformed username - `remote-{user}-{cluster}`.

This is a problem because when performing RBAC against the session
tracker - `contains(session_tracker.participants, user.metadata.name)` -
the root user in the leaf cluster could see it depending on the protocol he used
because the authorizer uses the transformed username.

This PR aligns all session trackers by adding a extra field `Cluster`
that carries the origin user's cluster and change the username to use
the real username instead of transformed.

The usernames are transformed before applying the session tracker RBAC.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* handle code review comment

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 8, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
backport-bot-workflows bot pushed a commit that referenced this pull request Sep 8, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2025
* fix: session trackers participants inconsistencies

This PR fixes some inconsistencies in session trackers' participants
across different protocols. Some protocols set the real username when
dealing with leaf clusters' sessions, while others, such as kube, set
the field to the transformed username - `remote-{user}-{cluster}`.

This is a problem because when performing RBAC against the session
tracker - `contains(session_tracker.participants, user.metadata.name)` -
the root user in the leaf cluster could see it depending on the protocol he used
because the authorizer uses the transformed username.

This PR aligns all session trackers by adding a extra field `Cluster`
that carries the origin user's cluster and change the username to use
the real username instead of transformed.

The usernames are transformed before applying the session tracker RBAC.



* handle code review comment

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
mmcallister pushed a commit that referenced this pull request Sep 22, 2025
* fix: session trackers participants inconsistencies

This PR fixes some inconsistencies in session trackers' participants
across different protocols. Some protocols set the real username when
dealing with leaf clusters' sessions, while others, such as kube, set
the field to the transformed username - `remote-{user}-{cluster}`.

This is a problem because when performing RBAC against the session
tracker - `contains(session_tracker.participants, user.metadata.name)` -
the root user in the leaf cluster could see it depending on the protocol he used
because the authorizer uses the transformed username.

This PR aligns all session trackers by adding a extra field `Cluster`
that carries the origin user's cluster and change the username to use
the real username instead of transformed.

The usernames are transformed before applying the session tracker RBAC.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* handle code review comment

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
mmcallister pushed a commit that referenced this pull request Sep 22, 2025
Similarly to #58853, session's end events also showed inconsistencies in
participant fiedls for different protocols.

This created an issue where root users couldn't watch session recordings
they participated depending on the protocol, while some local users
could.

Since ithe session's participants field is a repeated string, we can't apply the
same logic as in #58853, so we need to transform the username prior to
emitting the session end events. This will allow leaf users to see their
recordings.

Fixes #12324
Fixes teleport-private#166

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application-access audit-log Issues related to Teleports Audit Log backport/branch/v18 database-access Database access related issues and PRs desktop-access kubernetes-access no-changelog Indicates that a PR does not require a changelog entry size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants