Repository navigation
Fixes #28784: Interactive Test Login round-trip for SSO configuration - #34054
Conversation
Test Login now runs a real sign-in against the unsaved (candidate) SSO configuration for confidential OIDC, SAML, LDAP/Basic and public OIDC, as a dry run that never creates users, issues tokens or starts sessions, and shows the staged outcome and the resolved identity. Saving a new configuration, or an edit that changes how users sign in, is held until a test passes, with an explicit "Save anyway" override. - Admin-only start/result/credentials endpoints. The existing /callback and SAML ACS servlets fork on an "omtest:" marker before any live handling and render a constant page, so no IdP data reaches HTML. - Test sessions are bounded, bound to the starting admin and complete once; credential attempts are rate-limited; masked secrets are restored only when the candidate targets the same endpoint and TLS settings. - Sign-in addresses must be http(s), checked on the server and in the UI; the test popup's opener is cut; tested-identity tokens stay in memory. - The principal-claims mapping splits on the first colon only and is shared by the live OIDC handler, the request filter and Test Login.
|
✅ SSO Login Nightly — PASSED View workflow run · Commit
Totals: 94 passed · 0 failed · 0 flaky · 0 skipped · duration 18m 35s |
There was no reason to offer both. Test Login now starts with the checks Test Configuration ran - the same ones a save runs: fields, reachability, credentials - and signs in only when they pass. Problems tied to a field are marked in the form as before; the Test Login modal shows the check as its first step and lists every problem it found. The popup still opens inside the click, so browsers do not block it: the server-driven flows hold it blank until the check passes, and the public client flow runs the check at the point oidc-client reads the authorization endpoint, before it sends the popup anywhere.
An existing configuration no longer has an Edit button: a Google configuration opens on its Overview tab and the form sits under Configure, so the save-gate spec now opens that tab. The confidential-client spec's fake provider never sent the popup back, and the page cuts the popup's opener against reverse tabnabbing, which also means it cannot close a popup still showing another origin. Like a real provider, the fake one now redirects the popup to OpenMetadata's /callback, and the result settles only after that, so the page closes the popup once it is back on its own origin. The hook's comment now states that consequence of cutting the opener.
…t-login-roundtrip # Conflicts: # openmetadata-ui/src/main/resources/ui/src/components/SettingsSso/SSOConfigurationForm/SSOConfigurationForm.tsx
The server allows one credentials attempt per test and ends the test even when it refuses one, e.g. with a 429 from the per-admin limit. The hook still cleared the credentials step only on success, so after a refusal the form stayed live and a resubmission reached a finished test, getting "not waiting for credentials" in place of the real reason. The step now ends whatever the outcome; a retry starts a new Test Login.
Merging main brought its DataConsumer SPARQL policy update (#34231) into the 2.1.0 MySQL migration, and that merge's resolution placed the SSO Test Login table after the Flowable ALTER DATABASE, which FlowableCharsetMigrationTest requires to be the last statement. The table now sits between the policy update and the ALTER.
🚦 Removed from the merge queue —
|
…t-login-roundtrip Main's boot-bundle trim (#34202) moved getCandidateUserManagerConfig out of AuthProvider.util.ts into SsoTestLogin/candidateUserManagerConfig.ts, taking the version from before this branch hardened it. The moved copy is replaced with this branch's: the tested identity's tokens stay in an InMemoryWebStorage, the session is not monitored, and the settings are typed as UserManagerSettings. Its storage test moves to the new test file, and the hook test now imports the mocked module. vite.config.ts keeps main's split into vite/plugins.ts and vite/chunks.ts; the dev-only Test Login /callback proxy and its state predicate stay in the config.
The hook drops late responses by comparing the run id, but three paths set state after an await without checking it again: the result poll, the "server could not start" result, and the browser sign-in's failure. A poll answering after a new test started could overwrite that test's timeline with the old session's, and a reset modal could show a stale result or error. Each path now re-checks the run after its await, and an abandoned browser sign-in no longer has its token validated.
|
🚦 Removed from the merge queue —
|
…t-login-roundtrip Main's #34072 (keep SSO users signed in) builds its OidcProviderTokenRefresher from the live handler's createTokenRequest/executeTokenHttpRequest instance methods. This branch made those static, taking the configuration, so Test Login can redeem a code with the candidate's settings. The refresher now gets lambdas that call them with the live client's configuration and client authentication, which is exactly what the instance methods did. #34072 also normalizes the OIDC prompt and ignores max_age=0 for the live login. Test Login builds its own authorization request, so it now reads both values through the same normalizers. A candidate's max_age=0 no longer forces a fresh login in the test popup, and a padded value no longer makes the request unparseable. SsoTestLoginModal keeps this branch's core-components rewrite; main's Typography migration (#34106) only touched the antd version it replaced. SSOConfigurationForm imports both the core Button and the core Typography.
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
Code Review ✅ Approved 6 closed / 6 findings🔴 High risk · Adds server-side candidate sign-in flows and callback handling across SSO protocols Implements interactive Test Login round-trip for SSO configuration, allowing admins to validate OIDC, SAML, and LDAP candidates before saving. The feature runs real sign-ins against unsaved configurations with comprehensive security controls: encrypted session storage, credential rate limiting, dry-run isolation, and admin-only access. Five concurrent-request and state-management issues were resolved: credential race conditions, premature claim cleanup, secret retention on expiry, stale result overwrites, and form lifecycle handling. ✅ 6 closed✅ Edge Case: Credential test can be tried more than once under concurrent submits
✅ Edge Case: 429'd credential test is left claimed, never completed
✅ Security: Expired tests keep their sealed secrets until another test starts
✅ Edge Case: Credentials form stays live after the server has already ended the test
✅ Bug: Abandoned run's poll can still overwrite the newer run's result
...and 1 more closed from earlier reviews OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Describe your changes:
Fixes #28784
Saving a new SSO configuration signs the admin out. A configuration that passes Test Configuration but can't actually sign anyone in only shows up after that, and by then the admin is locked out. Phase 1 (#28780) added static validation and a browser-only Test Login for public OIDC clients. This PR makes Test Login run a real sign-in against the unsaved (candidate) configuration for every provider: confidential OIDC, SAML, LDAP and public OIDC.
Type of change:
High-level design:
One round-trip per protocol, each mirroring its live login
POST /v1/system/security/test-login/validate-tokenPOST …/test-login/start→ popup to the IdP → existing/callbackwithstate=omtest:<id>→ server-side code exchange with the candidate secret, plus PKCE, nonce and issuer checksstart→ popup → existing/api/v1/saml/acswithRelayState=omtest:<id>→ response signature checked against the candidate IdP certificatestart→requiresCredentials→ email and password in the modal →POST …/test-login/credentials→ one-off bind or BCrypt checkConfiguration check first. Every flow begins with
POST /v1/system/security/validate, the same call Test Configuration made, and signs in only if it passes. The popup must still open inside the click or browsers block it:start.The UI polls
GET …/test-login/result/{id}and renders a staged timeline: configuration checked → started → redirected → token received/validated (or credentials verified) → claims → identity → roles → domain.Dry run by construction
OidcIdentityResolver,SamlIdentityResolver,JwtIdentityResolver). The dry run stops beforeEmailFirstUserProvisioner.SecurityConfigurationManager, the servlet handler registry,SamlSettingsHolderandJwtFilterare all untouched.Security design
The two findings that closed #27336 are avoided by design:
TestLoginCallbackPage) sent withdefault-src 'none',no-store,no-referrerandnosniff. Results reach the UI as JSON from an admin-only endpoint.start,resultandcredentialsrequire a JWT andauthorizeAdmin.JwtFilter.EXCLUDED_ENDPOINTSis untouched./callbackand ACS servlets.omtest:marker before any live handling, and do nothing without a valid pending session.Other protections:
start, the IdP callback, theresultpolls,credentials) that can reach different servers, so it lives in one table,sso_test_login_session, following the MCP flow'smcp_pending_auth_requests:TestLoginSessionSweeperonce a minute to clear expired tests.UPDATE: a credentials test is claimed once before its password is checked, and the first callback wins.javascript:address from a hostile discovery document would otherwise run in the OpenMetadata origin.openeris set to null before any IdP page loads.authorization_endpoint, and keeps the tested identity's tokens in memory only.Save gate (UI only; the save endpoints are unchanged)
Related changes folded in
SecurityUtil.buildPrincipalClaimsMappingnow splits on the first colon only (from the Fixes #28781: Test Configuration option for SSO settings before save #28780 review). The live OIDC handler (initializeFieldsandvalidateConfig) now uses it too, so a test can't resolve a different principal than the live login would.AuthenticationCodeFlowHandler,LdapAuthenticator,BasicAuthenticatorandSamlSettingsHolderwere exposed (visibility andstaticonly), so the test reuses live code instead of copying it.Security review. A SAST pass over this change covered authorization, owner binding, replay, rate limits, the unauthenticated surface, secret restore, XSS/open redirect/SSRF, and writes during a dry run. It found and fixed:
opener;Accepted residual risks, all admin-only:
InResponseTo, OIDC PKCE and nonce follow the live login's settings rather than being stricter.Compatibility. The schema changes are additive:
testLoginResultgainsprotocol, astageenum,stagesand apendingstatus, and there are three new request/response schemas.validate-tokenkeeps its contract. One new table,sso_test_login_session, is added by the 2.1.0 migration for MySQL and Postgres.Tests:
Use cases covered
startcall); the modal lists the problems and the form marks the fields.javascript:sign-in address never reaches the browser.Unit tests
TestLoginRoundTripTest(including two servers sharing one store: a test started on one is finished on the other, and the credential cap holds across both),TestLoginSessionsTest,TestLoginPendingStateTest,TestLoginCandidatesTest,TestLoginCredentialHandlerTest(real in-memory LDAP directory),TestLoginOidcHandlerTest(FakeOidcProvider),TestLoginSamlHandlerTest(signedMockSamlIdpresponses),TestLoginStageRecorderTest,SamlAssertionConsumerServletTest,TestLoginSessionSweeperTest(a failed sweep does not cancel the later ones).TestLoginServiceTest,AuthCallbackServletTest,SecurityUtilTest.SsoTestLogin.utils.test.ts,SsoTestLoginCredentialsForm.test.tsx,SsoTestLoginModal.test.tsx,useSsoTestLogin.test.ts,SSOConfigurationForm.test.tsx,SsoTestLoginPopup.test.ts,AuthProvider.util.test.ts.TestLoginSessions,TestLoginSessionEntry,TestLoginCandidates,TestLoginStageRecorderandSamlAssertionConsumerServlet100%;TestLoginOidcHandler98%;TestLoginService97%;TestLoginPendingState96%;AuthCallbackServlet93%;TestLoginSessionSweeper92%;TestLoginSamlHandler88%;TestLoginRoundTrip77%;TestLoginCredentialHandler70%;JdbiTestLoginSessionStore0%. The JDBI store and the credential handler's Basic path run against a real database and user repository, whichSystemResourceITandTestLoginSessionSweepITexercise on MySQL and Postgres (ITs aren't instrumented). UI:SsoTestLogin.utils100%,SsoTestLoginCredentialsForm100%,SsoTestLoginModal97%,useSsoTestLogin95%,SsoTestLoginPopup94%.Backend integration tests
SystemResourceIThas 9 new tests:sso_test_login_sessionand its secrets are cleared once it completes;TestLoginSessionSweepIT(new): tests that get no further request lose their secrets within a minute of expiring. An unused one is deleted; a claimed one keeps only its row while it counts towards the credential limit. It waits for a real sweep, concurrently with the rest of the suite.main:SystemResourceIT48/48 andTestLoginSessionSweepIT1/1 on each.Ingestion integration tests
Playwright (UI) tests
SSOTestLogin.spec.tscovers:SSOTestLogin.spec.tsalso covers the single Test Login button and a configuration check that stops Test Login and shows its problems. The old "SSO Test Configuration" suite inSSOConfiguration.spec.tsis removed with the button.SSOConfigurationForm's metadata-upload test now submits through "Save anyway".lint:playwrightandtsc:playwrightare clean for these files. Not run locally; CI runs them.Manual testing performed
yarn start(Vite on :3000).POST /api/v1/system/security/test-login/startwithout a token returned 401./callback?state=omtest:…returned 200 with the constant page,Content-Security-Policy: default-src 'none'andCache-Control: no-store, and echoed nothing from the request.docker/local-sso(keycloak-samlfor confidential OIDC and SAML,openldapfor LDAP).UI screen recording / screenshots:
TODO: attach a recording of Test Login for OIDC, SAML and LDAP, and of the save gate. The PR stays a draft until it's attached.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.sso_test_login_session, has 2.1.0 migrations for MySQL and Postgres.)New feature:
🤖 Generated with Claude Code