Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support set.add on nil sets in traits expression parser #49385

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

nklaassen
Copy link
Contributor

@nklaassen nklaassen commented Nov 22, 2024

Fixes https://github.com/gravitational/teleport-private/issues/1786

This PR fixes a panic in the parser used for login rules and SAML IdP attribute mapping. The panic occurs when using the add method on a nil set. It is possible to get a nil set when indexing a dict with a key that is not present. For example, external["groups"].add("example") would panic if there was no "groups" trait.

These expressions can only be written by authenticated Teleport users with permission to create or edit login_rule or saml_idp_service_provider resources.

Changelog: Fixed a potential panic in login rule and SAML IdP expression parser

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from fheinecke November 25, 2024 15:02
@nklaassen nklaassen enabled auto-merge November 25, 2024 18:09
@nklaassen nklaassen added this pull request to the merge queue Nov 25, 2024
Merged via the queue into master with commit d807ea1 Nov 25, 2024
43 of 44 checks passed
@nklaassen nklaassen deleted the nklaassen/fix-parser branch November 25, 2024 18:31
@public-teleport-github-review-bot

@nklaassen See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Create PR

nklaassen added a commit that referenced this pull request Nov 25, 2024
Backport #49385 to branch/v16

This is a manual backport and a much smaller and more targeted change
than the original PR, because in this branch lib/expression.Set has not
been converted to use lib/utils.Set.

Changelog: Fixed a potential panic in login rule and SAML IdP expression parser
nklaassen added a commit that referenced this pull request Nov 25, 2024
Backport #49385 to branch/v15

This is a manual backport and a much smaller and more targeted change
than the original PR, because in this branch lib/expression.Set has not
been converted to use lib/utils.Set.

Changelog: Fixed a potential panic in login rule and SAML IdP expression parser
github-merge-queue bot pushed a commit that referenced this pull request Nov 26, 2024
…49431)

Backport #49385 to branch/v16

This is a manual backport and a much smaller and more targeted change
than the original PR, because in this branch lib/expression.Set has not
been converted to use lib/utils.Set.

Changelog: Fixed a potential panic in login rule and SAML IdP expression parser
github-merge-queue bot pushed a commit that referenced this pull request Nov 26, 2024
…49432)

Backport #49385 to branch/v15

This is a manual backport and a much smaller and more targeted change
than the original PR, because in this branch lib/expression.Set has not
been converted to use lib/utils.Set.

Changelog: Fixed a potential panic in login rule and SAML IdP expression parser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants