Repository navigation
feat(users): store the IdP profile on OAuth sign-in; trusted email domains (#877, #878) - #921
Merged
Merged
Conversation
#878) get_identity returns an OAuthIdentity with subject, username, display name and (Microsoft) oid/tid. oauth_trusted_email_domains lets microsoft (a member of a pinned tenant: upn/preferred_username, or email only with xms_edov) and oidc vouch for addresses on listed domains. Google and GitHub are refused: anyone can add an unverified address on any domain there. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
OAuthAccount gains subject, username, display_name, extra and last_sign_in_at (migration e480d7dd348f on the users trunk), refreshed on every sign-in. A new account takes full_name from the IdP's display name; later sign-ins update it only with oauth_sync_profile. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…verified: false (#878) Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Shared text_or_none helper; a validated ID token without sub no longer 500s; OAuthAccount column docs. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Google display name from the primary name, junk-safe; Google's explicit unverified blocks domain trust; docs on Google names and guest UPNs. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…Hub profile request (#877) Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Deploying simple-module-python with
|
| Latest commit: |
df93515
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ae3e2af6.simple-module-python.pages.dev |
| Branch Preview URL: | https://feat-issue-877-878-oauth-pro.simple-module-python.pages.dev |
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
get_identityreturns anOAuthIdentity: account id, email, proof, subject, username, display name, andextraholding Microsoft'soid/tid.users_oauth_accountgainssubject,username,display_name,extraandlast_sign_in_at, refreshed on every sign-in. Migratione480d7dd348fon the users trunk; the migration-graph test anddocs/database/migrations.mdare updated.full_namefrom the IdP's display name.oauth_sync_profile(off by default) updates it on later sign-ins. The email is never changed.namesfrom the People API, so its display name arrives. GitHub reads/useronce.oauth_trusted_email_domains, for example{"microsoft": ["iiasa.ac.at"]}. Matches are exact, case-insensitive, IDNA-normalised and never include subdomains.microsoft: only for a member of a pinned tenant GUID (matchingtid, no foreignidp, no guest#EXT#UPN in any name claim). The address isupn/preferred_username, or theemailclaim only whenxms_edovmarks its domain verified.oidc: a listed domain never overrides an explicitemail_verified: false.googleandgithubare refused at validation. Anyone can add an unverified address on any domain to those accounts, so a domain can't vouch for them. The automated security review flagged it.docs/modules/users.md("Trusted email domains", "Linked identities", column list), CHANGELOG.docs/superpowers/specs/2026-11-11-oauth-profile-trusted-domains-design.md.Closes #877
Closes #878
Verification
@tricks);xms_edovcases;make lintpasses,make test-pyhas 8444 passed and 28 skipped,make test-jshas 907 passed.make ci-doctor(alembic check) andmake migrations-roundtrip-pgpass.Test plan
https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4