Fix default IdP validation rejecting server-wide identity providers#3384
Open
jaisinha77777 wants to merge 1 commit into
Open
Fix default IdP validation rejecting server-wide identity providers#3384jaisinha77777 wants to merge 1 commit into
jaisinha77777 wants to merge 1 commit into
Conversation
Setting a default identity provider on a resource policy failed with "Identity provider not found in this organization" because the validation required an idpOrg link row. Server-wide IdPs created via the server admin panel never get one; only org-scoped IdPs do (SaaS or identity_provider_mode: org). Validate against the same rule the resource login page uses: require the org link only when IdPs are org-scoped, otherwise accept any existing server-wide IdP. Fixes fosrl#3290
jaisinha77777
requested review from
miloschwartz and
oschwartz10612
as code owners
July 3, 2026 00:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3290
What
Setting a default identity provider (Platform SSO) on a resource's Authentication tab fails with
Identity provider not found in this organizationon Community Edition / self-host since 1.19. As noted in the issue thread, hitting Save Settings on any Auth tab that has a default IdP set reproduces it.Why
setResourcePolicyAccessControlvalidatesskipToIdpIdwith an inner join onidpOrg, so it only accepts IdPs that have an org link row. But server-wide IdPs created through the server admin panel (createOidcIdp) never get anidpOrgrow - only org-scoped IdPs do (SaaS build oridentity_provider_mode: org). The check shipped with the resource policies rework in 1.19, which is why this appeared after upgrading from 1.18.The resource login page itself has the correct rule: it offers org-scoped IdPs when
build === "saas" || identityProviderMode === "org", and otherwise offers every server-wide IdP from/idp. So any server-wide IdP is genuinely usable as a skip-to IdP on self-host - the save-time validation was just stricter than the runtime behavior.How
canOrgUseIdp(idpId, orgId)inserver/lib/idp/canOrgUseIdp.ts: left-joins the org link and only requires it when IdPs are org-scoped (SaaS build orIDENTITY_PROVIDER_MODE === "org", matching how other OSS routes read the mode). Otherwise any existing IdP passes.setResourcePolicyAccessControl(OSS) andcreateResourcePolicy(private), which had the same inner-join check duplicated.Behavior is unchanged for SaaS / org-scoped mode: the org link is still required there.
Testing
tsc --noEmitpasses on both the oss and enterprise configurations.