Skip to content

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

Merged
nklaassen merged 1 commit intomasterfrom
nklaassen/fix-parser
Nov 25, 2024
Merged

fix: support set.add on nil sets in traits expression parser#49385
nklaassen merged 1 commit intomasterfrom
nklaassen/fix-parser

Conversation

@nklaassen
Copy link
Copy Markdown
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
@nklaassen nklaassen deleted the nklaassen/fix-parser branch November 25, 2024 18:31
@public-teleport-github-review-bot
Copy link
Copy Markdown

@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
carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
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