Validate fallback email field as valid address before passing to EmailStr#91
Merged
Conversation
implemented by codex
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr91-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr91-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-91.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr91-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_91 | stitch-dev.postgres.database.azure.com |
5432 |
pr_91 |
Jobs (2)
| job | image | postgres_db | api_url | auth_mode |
|---|---|---|---|---|
| db-init | ghcr.io/rmi/stitch-api:pr91@sha256:23829d38a903e3d2255e1afb1444a024273da3c0f1476b88a1e9767dfe633930 |
pr_91 |
||
| seed | ghcr.io/rmi/stitch-seed:pr91@sha256:817be71a839edbee4cbe62b9e092d6975b3a9ea928e1a6d1e1cc7ce1cec8ccdf |
https://pr91-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 |
dev placeholder bearer token |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-05-12T09:22:23Z | 2026-05-12T09:22:11Z | 265a000 | ghcr.io/rmi/stitch-api:pr91 |
ghcr.io/rmi/stitch-api:pr91@sha256:23829d38a903e3d2255e1afb1444a024273da3c0f1476b88a1e9767dfe633930 |
| 2026-05-12T09:22:25Z | 2026-05-12T09:22:11Z | 265a000 | ghcr.io/rmi/stitch-entity-linkage:pr91 |
ghcr.io/rmi/stitch-entity-linkage:pr91@sha256:321cc5e045b296b37822e3625e930f3bcce78b0c720ad442701f5656c6d5af7a |
| 2026-05-12T09:22:33Z | 2026-05-12T09:22:11Z | 265a000 | ghcr.io/rmi/stitch-seed:pr91 |
ghcr.io/rmi/stitch-seed:pr91@sha256:817be71a839edbee4cbe62b9e092d6975b3a9ea928e1a6d1e1cc7ce1cec8ccdf |
| 2026-05-12T09:22:29Z | 2026-05-12T09:22:11Z | 265a000 | ghcr.io/rmi/stitch-stitch-llm:pr91 |
ghcr.io/rmi/stitch-stitch-llm:pr91@sha256:c60904ff51ea21d9f4272b358c84dbb6a7625a4dc48cc729e1cf1037431e4159 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens how stitch-auth derives TokenClaims.email from OIDC payloads by only accepting email-like values (including when falling back to preferred_username), preventing non-email usernames from being written into the email field downstream.
Changes:
- Added
_validated_email()to filter/validateemailandpreferred_usernamepayload values before settingTokenClaims.email. - Updated
JWTValidator.validate()to prefer a validatedemailclaim and otherwise fall back to a validatedpreferred_username. - Added unit tests covering invalid
preferred_usernamefallback and malformedemailclaim behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/stitch-auth/src/stitch/auth/validator.py | Adds email validation helper and applies it to email / preferred_username claim extraction. |
| packages/stitch-auth/tests/test_validator_unit.py | Adds unit tests for ignoring non-email preferred_username and falling back when email is malformed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr91-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr91-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-91.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr91-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_91 | stitch-dev.postgres.database.azure.com |
5432 |
pr_91 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-init | ghcr.io/rmi/stitch-api:pr91@sha256:b9a58c0136851d6fd36bea5d3ff5cae9e127315ad82fb50366880b4c77f5b174 |
pr_91 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-05-12T09:29:17Z | 2026-05-12T09:29:05Z | 12e1ef0 | ghcr.io/rmi/stitch-api:pr91 |
ghcr.io/rmi/stitch-api:pr91@sha256:b9a58c0136851d6fd36bea5d3ff5cae9e127315ad82fb50366880b4c77f5b174 |
| 2026-05-12T09:29:22Z | 2026-05-12T09:29:05Z | 12e1ef0 | ghcr.io/rmi/stitch-entity-linkage:pr91 |
ghcr.io/rmi/stitch-entity-linkage:pr91@sha256:7947b8e8bf457df63942fb9359b0c240a7396ac5d66748d8d3349c8114dc1756 |
| 2026-05-12T09:29:15Z | 2026-05-12T09:29:05Z | 12e1ef0 | ghcr.io/rmi/stitch-seed:pr91 |
ghcr.io/rmi/stitch-seed:pr91@sha256:fd9c03f6f4731490b953652500c4b1040b20cde4a7753d9c46f23f2208131619 |
| 2026-05-12T09:29:19Z | 2026-05-12T09:29:05Z | 12e1ef0 | ghcr.io/rmi/stitch-stitch-llm:pr91 |
ghcr.io/rmi/stitch-stitch-llm:pr91@sha256:92dfd0e814529502e6e6aff15556a4e5dc45a064dd14905e7795c4a17258c084 |
mbarlow12
approved these changes
May 13, 2026
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.
implemented by codex
Followup to #85, validates the fallback
preferred_usernameas an email before writing it to theemailuser field.Note to reviewers: Opening this as one possible way to preserve the meaning of
emailfield. Alternately, we could not useEmailStrvalidation, and just store astr, but in that case, I would suggest we call it something other thanemailin our data model