fix(core): trim trailing slash from the SSO OIDC discovery URL - #9586
Open
simeng-li wants to merge 1 commit into
Open
fix(core): trim trailing slash from the SSO OIDC discovery URL#9586simeng-li wants to merge 1 commit into
simeng-li wants to merge 1 commit into
Conversation
COMPARE TO
|
| Name | Diff |
|---|---|
| .changeset/purple-eels-shave.md | 📈 +712 Bytes |
| packages/core/src/sso/OidcConnector/utils.test.ts | 📈 +1.02 KB |
| packages/core/src/sso/OidcConnector/utils.ts | 📈 +911 Bytes |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes OIDC discovery failures caused by trailing slashes and improves outbound-request error reporting.
Changes:
- Normalize discovery URLs without changing stored issuers.
- Format HTTP and transport errors clearly.
- Add unit tests and a changeset.
File summaries
| File | Description |
|---|---|
packages/core/src/sso/OidcConnector/utils.ts |
Normalizes discovery URLs and error payloads. |
packages/core/src/sso/OidcConnector/utils.test.ts |
Tests URL normalization and error formatting. |
.changeset/purple-eels-shave.md |
Documents the bug fix. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
charIeszhao
reviewed
Sep 11, 2026
wangsijie
approved these changes
Sep 11, 2026
simeng-li
force-pushed
the
simeng-fix-sso-issuer-trailing-slash
branch
from
September 11, 2026 06:36
97f3206 to
2d4ecd1
Compare
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.
Summary
Closes #9583.
Context
An OIDC enterprise SSO connector whose
Issuerends with a slash builds its discovery request as<issuer>//.well-known/openid-configuration. Identity providers that do not collapse the doubled slash reject it, and every sign-in through that connector fails —getAuthorizationUrlrefetches the discovery document on each attempt.The resulting failure is also hard to act on.
koa-connector-error-handlerpasses the connector error'sdatastraight into the response body and the audit log, and the Console pins anyinvalid_connector_configonto the Issuer field, so the operator sees the field flagged with a payload that does not say what went wrong.What changed
fetchOidcConfigRawtrims trailing slashes from the issuer when building the discovery URL (packages/core/src/sso/OidcConnector/utils.ts:47). This is request-shaping only — the stored issuer is untouched, becauseuser_sso_identitiesis keyed on the raw configured issuer and rewriting it would orphan existing SSO identities.describeRequestError, used at the five catch blocks in the same file that build anSsoConnectorErrorpayload from a caught outbound-request error. It returns{ statusCode, body }for anHTTPErrorand<name>: <message>otherwise, instead of handing the caught error over verbatim.Expected result
https://idp.example.com/now requestshttps://idp.example.com/.well-known/openid-configuration, matching RFC 8414 §3.1.Errorreduced to{}, while agoterror serialized its whole request options object.Reviewer notes
fetchOidcConfigRaw's other caller,packages/core/src/saml-application/SamlApplication/index.ts:315, passes Logto's own endpoint-derived issuer, so the trim is inert there.Testing
Unit tests
Checklist
.changeset