Repository navigation
fix: Reject SAML logins without an email and default the SAML email mapping (OHE-4202) - #1447
Merged
Merged
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
tofarr
marked this pull request as ready for review
November 18, 2026 16:13
Contributor
|
🚀 Released in 1.95.0. |
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.
HUMAN:
I tested locally - see screenshots and video.
AGENT:
Why
A SAML provider with no email mapping (and a non-email NameID, e.g. Keycloak's
persistentG-<uuid>) logs users in withemail=None.UserStore.create_userthen creates the personal org withcontact_email=NULL, and/api/organizationsfails with a 500 (OrgResponse.contact_emailis a requiredstr). The admin sees a generic "Could not load your workspaces" error and nothing points at the provider config.Summary
saml_acsnow returns a 400 when no email can be resolved (mapped attribute or email-typed NameID), before any user/org is created. The message tells the admin to map the IdP's email attribute; a warning log lists the attribute names the assertion carried.attribute_mappingto{ email: "email" }.Issue Number
N/A
How to Test
uv run pytest tests/unit/server/routes/test_saml_routes.py(26 pass; run with--noconftestin a sandbox with no Docker, since these tests mock the stores)cd frontend && npx vitest run __tests__/components/features/super-admin/super-admin-auth-providers.test.tsx __tests__/components/features/super-admin/super-admin-auth-provider-edit.test.tsx(72 pass)email=email. Clear it, log in with an IdP that sends a persistent NameID, and confirm the ACS returns the 400 instead of creating a user.The root cause was found on
app.shared-2.replicated.all-hands-testing.dev, where adding{"email": "email"}to the provider fixed login.Video/Screenshots
New SAML Idps set up their attribute mappings to include email by default and SAML Works...
Screen.Recording.2026-11-18.at.4.05.34.PM.mov
If I deliberately break it...
Then I get an error on login...
Type
Notes
OrgResponse.contact_emailstill rejectsNone, and the "Could not load your workspaces" wording lives in the Agent Canvas SPA (OpenHands/OpenHands).This PR was created by an AI agent (OpenHands) on behalf of Tim.
@tofarr can click here to continue refining the PR
Enterprise server image for this PR: