Skip to content

Okta: Add disableAssignDefaultRoles to plugin sync settings#54878

Merged
kopiczko merged 2 commits intomasterfrom
kopiczko/okta__allow_disable_okta_requester_role
May 23, 2025
Merged

Okta: Add disableAssignDefaultRoles to plugin sync settings#54878
kopiczko merged 2 commits intomasterfrom
kopiczko/okta__allow_disable_okta_requester_role

Conversation

@kopiczko
Copy link
Copy Markdown
Contributor

@kopiczko kopiczko commented May 16, 2025

Issue https://github.com/gravitational/teleport.e/issues/6533

Requires #54924 (so we don't have a mess with the fields order)

Related E changes https://github.com/gravitational/teleport.e/pull/6537

It also enables Access Requests to Okta-originated resources when only App and Group sync is enabled (no Access List sync) a0910a3

Backports:

Comment thread tool/tctl/common/plugin/okta.go Outdated
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch 3 times, most recently from 177cf08 to b8ff68e Compare May 19, 2025 10:56
@kopiczko kopiczko changed the title Okta: Add disable_okta_requester_role to Okta plugin Okta: Add disableOktaRequesterRoleAssignment to plugin sync settings May 19, 2025
@kopiczko kopiczko added backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry labels May 19, 2025
@kopiczko kopiczko marked this pull request as ready for review May 19, 2025 10:58
@github-actions github-actions Bot added size/md tctl tctl - Teleport admin tool labels May 19, 2025
Comment thread api/proto/teleport/legacy/types/types.proto Outdated
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from probakowski May 19, 2025 16:15
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch 2 times, most recently from f979869 to 9272528 Compare May 20, 2025 14:49
@kopiczko kopiczko changed the title Okta: Add disableOktaRequesterRoleAssignment to plugin sync settings Okta: Add disableAssignOktaRequesterRole to plugin sync settings May 20, 2025
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch from 9272528 to babd96c Compare May 20, 2025 21:08
Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smallinsky and I discussed this yesterday and instead of having a boolean flag to disable the role we instead decided that having a way to provide default role for the integration (which would default to okta-requester) would be a better UX/design. This way users can override it to their own crafted role if they choose to. It looks like this PR still implements the "disable" flag.

@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch from 798ba33 to 31b65ef Compare May 22, 2025 09:45
@kopiczko
Copy link
Copy Markdown
Contributor Author

kopiczko commented May 22, 2025

@r0mant

Just to make things clear: the primary goal of this work is not to allow replace the default okta-requester role assignment but rather being able to disable the default okta-requester role assignment altogether. This is to allow the situation that was possible using the legacy okta_service with SAML connector role mapping without the User Sync enabled.

I tried to convert this to a string slice (defaultRoles []string), but because of backward-compatibility reasons we can't treat an empty list of roles as no roles. It can mean 2 things: either ["okta-requester"] for exiting plugins or [] for newly created plugins. So there are solutions I can think of:

  1. Introducing PluginV2.

This sounds like too much effort for such a simple feature and we wouldn't be able to deliver in a reasonable time.

  1. Using a boxed type like spec.okta.syncSettings.defaultRoles.value=[...] (instead of expected spec.okta.syncSettings.defaultRoles). And then rely on certain JSON rendering and checking for nil

I don't like this for 2 reasons:

  • we need to have this .value thing and it makes IaC tools UX significantly worse
  • and more importantly relying on proper JSON rendering and unmarshaling doesn't seem very robust
  1. Requiring defaultRoles []string to always be not empty when set, and defaulting the empty slice to ["okta-requester"].

This seems ok but:

  • it is not what the current customer needs, that would provide a workaround of being able to set a dummy default role, but from what I understand, what they need is just to disable it
  • this would require a significant extra work on the SAML connector evaluation side where we have fixed preserved roles (#4995) because currently the plugin resource is not cached
  1. (my preference) Introducing a bool value disableDefaultRoles bool as a first stage (this PR) and then adding defaultRoles []string if ever needed.

This has several advantages:

  • addresses the customer's problem without workarounds
  • backward-compatibility is solid and doesn't rely on JSON rendering and unmarshaling
  • the IaC tool UX is not terrible if we want to create a TF/K8s resource
  • tctl is also not bad and can evolve without any deprecations
  • we can come up with some more advanced/tailored design instead of a simple list of static roles which btw is currently possible with both the SAML connector and Access Lists
  • there is a flow where we create SAML connector if it doesn't exist during the integration setup - in this case it's easier to always have non-empty defaultRoles because SAML connector requires at least one role mapping (same applies to solution 3.)

Potential tctl evolution as the flags get added:

// for now:

tctl plugins install okta --[no-]assign-default-roles // defaults to true

// potentially in the future (after introducing defaultRoles slice):

tctl plugins install okta -h
      --[no-]assign-default-roles  Enables/disables default roles assignment. Defaults to true.
      --default-roles              Default roles roles to be assigned to all synchronized users. Defaults to ["okta-requester"].

// typical usage:

tctl plugins install okta --no-assign-default-roles          // no roles assigned
tctl plugins install okta --default-roles=my_role1,my_role2  // overwrite for okta-requester

// error for empty default roles:

$ tctl plugins install okta --default-roles=""
error: default roles must not be empty, if you want to disable default roles assignment, use --no-assign-default-roles

So for now I went with the first part of 4. and renamed the bool flag to disableAssignDefaultRoles with a potential of seamless extension.

Please LMK what you think.


EDIT: Another alternative that came to mind. Personally I don't feel it's much better than 4. if at all because it cements the simplistic design, but it allows to have defaultRoles in gRPC requests and tctl, but will still require a bool in the plugin spec.

message CreateIntegraitonRequest {
  // Default roles to assign to all synced users. Currently be either [] or
  // ["okta-requester"].
  repeated string default_roles = 100;
}

message UpdateIntegraitonRequest {
  // Default roles to assign to all synced users. Currently be either [] or
  // ["okta-requester"].
  repeated string default_roles = 100;
}

message PluginOktaSyncSettings {
  // DisableAssignDefaultRoles allows to disable okta-requster role assigments
  // to all synced users.
  bool disble_assign_default_roles = 100;

  //// ** POSSIBLY IN FUTURE: **
  //// // Default roles to assign to all synced users. It must contain at least
  //// // 1 role. Defaults to ["okta-requester"]. Default roles assignment can 
  //// // be disabled with DisableAssignDefaultRoles.
  //// repeated string default_roles = 101;
}

$ tctl plugins install okta --default-roles=""                // disables
$ tctl plugins install okta --default-roles="okta-requester"  // default
$ tctl plugins install okta --default-roles="role1,role2"     // error, until `PluginOktaSyncSettings.default_roles` is introduced

@kopiczko
Copy link
Copy Markdown
Contributor Author

Updated the comment above.

@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch 2 times, most recently from 4cbe5e4 to 515384c Compare May 22, 2025 11:03
@kopiczko kopiczko changed the title Okta: Add disableAssignOktaRequesterRole to plugin sync settings Okta: Add disableAssignDefaultRoles to plugin sync settings May 22, 2025
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch 2 times, most recently from 0ecbc98 to 49d4a41 Compare May 23, 2025 18:39
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch from a0910a3 to bbc7bef Compare May 23, 2025 19:52
@kopiczko kopiczko enabled auto-merge May 23, 2025 19:53
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch 2 times, most recently from 1d196c4 to b5b4085 Compare May 23, 2025 20:30
@kopiczko kopiczko force-pushed the kopiczko/okta__allow_disable_okta_requester_role branch from b5b4085 to 33cf218 Compare May 23, 2025 20:53
@kopiczko kopiczko added this pull request to the merge queue May 23, 2025
Merged via the queue into master with commit da2be0d May 23, 2025
45 of 46 checks passed
@kopiczko kopiczko deleted the kopiczko/okta__allow_disable_okta_requester_role branch May 23, 2025 21:40
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@kopiczko See the table below for backport results.

Branch Result
branch/v17 Failed

@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@kopiczko See the table below for backport results.

Branch Result
branch/v17 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/md tctl tctl - Teleport admin tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants