Skip to content

[v17] fix: tsh label based commands always running serially#63611

Merged
rosstimothy merged 1 commit intobranch/v17from
bot/backport-63555-branch/v17
Feb 9, 2026
Merged

[v17] fix: tsh label based commands always running serially#63611
rosstimothy merged 1 commit intobranch/v17from
bot/backport-63555-branch/v17

Conversation

@rosstimothy
Copy link
Contributor

Backport #63555 to branch/v17

changelog: Fixed tsh ssh user@foo=bar uptime from running serially if users did not have role:read permissions.

When using tsh ssh user@foo=bar uptime, the command is
supposed to be run in parallel on all matching hosts unless
Per-Session MFA is required, or the user has a restriction on
the number of concurrent sessions.

To determine if limits are enforced, tsh would list roles and
take the maximum from all of them and add with a small buffer
to prevent exceeding the limit. It turns out that this only
works for users that have permissions to read Role resources.
ListRoles does **not** return the roles of the current user
if they do not have permissions to read roles like GetRole
does. The result is that users that cannot read roles have
all of the command run serially instead of in parallel even
if they have _no_ connection limits in their roles.

It looks like this has been the case for GetRoles and ListRoles
since their inception. This has likely gone unnoticed because
this is either a very uncommon workflow, or the users performing
this regularly have read permissions for Role resources.

There does exist an RPC that provides a user with all of
the roles they are assigned regardless of their permissions:
GetCurrentUserRoles. This RPC is now used in place of ListRoles
when determining connection limits in tsh label based ssh.
@rosstimothy rosstimothy marked this pull request as ready for review February 6, 2026 22:13
@github-actions github-actions bot added backport size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Feb 6, 2026
@rosstimothy rosstimothy added this pull request to the merge queue Feb 9, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 9, 2026
When using tsh ssh user@foo=bar uptime, the command is
supposed to be run in parallel on all matching hosts unless
Per-Session MFA is required, or the user has a restriction on
the number of concurrent sessions.

To determine if limits are enforced, tsh would list roles and
take the maximum from all of them and add with a small buffer
to prevent exceeding the limit. It turns out that this only
works for users that have permissions to read Role resources.
ListRoles does **not** return the roles of the current user
if they do not have permissions to read roles like GetRole
does. The result is that users that cannot read roles have
all of the command run serially instead of in parallel even
if they have _no_ connection limits in their roles.

It looks like this has been the case for GetRoles and ListRoles
since their inception. This has likely gone unnoticed because
this is either a very uncommon workflow, or the users performing
this regularly have read permissions for Role resources.

There does exist an RPC that provides a user with all of
the roles they are assigned regardless of their permissions:
GetCurrentUserRoles. This RPC is now used in place of ListRoles
when determining connection limits in tsh label based ssh.
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 9, 2026
@rosstimothy rosstimothy added this pull request to the merge queue Feb 9, 2026
Merged via the queue into branch/v17 with commit 7fe844d Feb 9, 2026
43 checks passed
@rosstimothy rosstimothy deleted the bot/backport-63555-branch/v17 branch February 9, 2026 14:46
This was referenced Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments