Repository navigation
Conversation
This was referenced Nov 25, 2026
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | ec338df | Nov 25 2026, 08:25 PM |
tnkuehne
force-pushed
the
app-profile-pictures
branch
from
November 25, 2026 18:08
b7f74c3 to
ce2d827
Compare
tnkuehne
force-pushed
the
docs-profile-pictures
branch
2 times, most recently
from
November 25, 2026 18:18
d291e1c to
dbe3e9a
Compare
tnkuehne
force-pushed
the
app-profile-pictures
branch
from
November 25, 2026 20:06
cc4efa8 to
2e63741
Compare
tnkuehne
force-pushed
the
docs-profile-pictures
branch
from
November 25, 2026 20:06
dbe3e9a to
a726941
Compare
tnkuehne
force-pushed
the
app-profile-pictures
branch
from
November 25, 2026 20:09
2e63741 to
bfd0447
Compare
tnkuehne
force-pushed
the
docs-profile-pictures
branch
from
November 25, 2026 20:09
a726941 to
b6bfe8b
Compare
tnkuehne
force-pushed
the
app-profile-pictures
branch
from
November 25, 2026 20:17
bfd0447 to
7ddc76b
Compare
tnkuehne
force-pushed
the
docs-profile-pictures
branch
from
November 25, 2026 20:17
b6bfe8b to
1a9a64a
Compare
tnkuehne
added a commit
that referenced
this pull request
Nov 25, 2026
Each Google, Microsoft or company SSO sign-in now copies the person's picture into the control plane's own store. Pages load it from Widefleet, never from the provider. Microsoft and Entra pictures, which have no URL, appear as well. ## Why The control plane showed provider picture URLs directly (#404). Microsoft and Entra supply the photo only as bytes from Microsoft Graph, and apps cannot load pictures from another origin. One copy per person covers every provider and gives apps a picture to serve (follow-up PR). ## Changes - **Copy on sign-in:** The `sign-in-picture` plugin runs after `/callback/:id` and `/sso/callback/:providerId`. - Microsoft and Entra: it fetches `/me/photos/120x120/$value` from Graph with the sign-in's access token. - Google and company OIDC: it reads the ID token's `picture` claim. When the ID token names none, it reads the user info with the sign-in's access token: Google's (`openidconnect.googleapis.com/v1/userinfo`) for personal Google sign-in, because Google leaves `picture` out of Workspace accounts' ID tokens, and the connection's discovered endpoint for company SSO. - Which hosts it asks (`fetchPictureUrl`): only the provider's own origin, which receives the access token like its other endpoints, and Google's account picture host. Other hosts are never contacted, so no DNS check is needed. Redirects are not followed. - **Scopes:** Personal Microsoft sign-in requests `User.Read`. Saving an Entra company SSO connection adds `User.Read`, which its registration already grants for app membership checks. - **Validation:** PNG, JPEG, GIF or WebP up to 100 KB. The bytes decide the type; SVG is never stored. The fetch and validation live in `@platform/auth-proxy/picture`, so the app proxy can use them in the follow-up. - **Store:** A new `user_picture` table holds one row per user, outside the `user` row that Better Auth reads on every session lookup. - Deleting a user deletes the row (foreign key cascade). - Each write locks the user's row, so concurrent sign-ins leave the copy and `user.image` in agreement. - A sign-in whose picture cannot be read keeps the current copy. A provider that reports none (no `picture` in the ID token or user info, or Graph `404`) removes it. - **`user.image`:** Holds `/users/{id}/picture?v={version}`, never a provider URL. The contract `profileImage` accepts only that path. A provider URL that Better Auth stores at sign-up is cleared when no copy can be made. - **Claims:** Widefleet's own ID tokens and user info carry `picture` as an absolute URL on the installation. - **Route `/users/{id}/picture`:** - Who sees what: a person always sees their own picture; others see it only as an administrator of an organization both belong to, the same rule as the member list. An organization that requires company SSO counts only for a company sign-in. - Caching: `ETag` with `Cache-Control: private, no-cache`, so the check runs on every view and removal from an organization takes effect. - Safety headers: `nosniff`, a sandboxing CSP and `same-origin` resource policy. - `users` joins the reserved organization slugs like the other top-level pages. Existing Entra connections request `User.Read` after their next save in **Company sign-in**. Company OIDC providers that host pictures elsewhere than their own origin or Google's picture host show initials. ## Documentation `apps/docs/docs/reference/social-sign-in.md` says Microsoft sign-in requests `openid`, `profile` and `email`. It now also requests `User.Read`. Draft docs PR: #411. ## Verification - `packages/auth-proxy/src/picture.test.ts`: - Fetching: type detection by bytes (SVG and HTML rejected), size limit, `404` vs. failure, no redirects. - Hosts: only the provider origin, which gets the bearer token, and Google's picture host; other, private and credentialed hosts are never requested. - Graph: request with the bearer token. - `social-sign-in.test.ts`: Google copies the picture and leaves name and email unchanged. SVG and `http` pictures are not copied. A Workspace sign-in without the claim copies the picture from Google's user info, keeps the copy when user info fails, and reports none when user info names none. Microsoft asks Graph with the stored access token. - `company-sso-plugin.integration.test.ts`: a company OIDC sign-in stores a copy from its ID token; a returning sign-in that names a new picture only in its user info replaces the copy. Both cover registered and migrated (runtime-discovered) connections. - `user-pictures.integration.test.ts`: replacing and removing a copy; cascade on user deletion; visibility for the owner, an administrator of a shared organization, and not for members, other organizations, an organization that requires company SSO, or after leaving. - `organization-settings.integration.test.ts`: a saved Entra connection requests `User.Read`. - `organization-sso.integration.test.ts`: Widefleet's app sign-in ID token and user info carry the absolute picture URL. - Rendered the member list and sidebar from a real server with copied pictures: all three images load through the route with the session cookie. The look is unchanged from #404. - `svelte-check`, Oxlint and Oxfmt are clean. `runtime-errors.integration.test.ts` needs a built server and fails on `main` the same way locally. Not verified against a real Microsoft tenant: the Entra and personal Microsoft Graph calls are covered with synthetic responses. <!-- greptile_comment --> <!-- greptile_summary --> <h2><ruby><rp>Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.</rp></ruby><a href="https://app.greptile.com/api/retrigger?id=119692309&sig=83e8ab2ccf6f4e33625d86284702156c2f94e504e1754c48223fe620121d4272"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F407&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no new actionable issues were found. <details open><summary><h3>Summary</h3></summary> Copies provider pictures into `user_picture` during sign-in and serves them through an access-checked route. - Sign-ins copy profile pictures into Widefleet’s own store. - The control plane serves profile pictures through a checked Widefleet route. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart LR A[Provider sign-in] --> B[Read picture claims or Graph photo] B --> C[Check host, size and image type] C --> D[Lock user row] D --> E[Save picture and local path together] E --> F[Picture request] F --> G[Check current access] G --> H[Return image or 304] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (6) · Last reviewed commit: ["Keep the picture when user info discover..."](b6e9332) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
tnkuehne
added a commit
that referenced
this pull request
Nov 25, 2026
Apps now get each signed-in person's profile picture from their own
address. The app sign-in proxy copies the picture when someone signs in
to an app. It serves it at `/oauth2/pictures/{subject}` on every app
origin of the organization and names it in a new
`x-auth-request-picture` header.
Stacked on #407.
## Why
The control plane keeps its own copy of each person's picture (#407),
but apps cannot use it:
- The app CSP allows images only from the app's own origin.
- People who only use apps through company SSO may never sign in to the
control plane.
The proxy already holds the company sign-in's tokens and serves every
app origin, so it copies and serves the picture itself. It never asks
the control plane.
## Changes
- **Copy at app sign-in and renewal:** `getUserInfo` in the auth proxy
reads the picture with the shared `providerPicture`:
- Entra: Graph `/me/photos/120x120/$value`. The proxy already requests
`User.Read`.
- Google Workspace and company OIDC: the ID token's `picture`, or the
user info when the ID token names none (Google's endpoint for Workspace,
whose ID tokens never carry `picture`; the discovered endpoint for
OIDC). Only the provider's own origin, with the access token, or
Google's account picture host is asked for the picture.
- Widefleet's own app sign-in: the absolute `picture` claim from #407.
The proxy fetches it from the installation with the sign-in's access
token. `/users/{id}/picture` accepts that token for the person's own
picture only (`tokenViewer`). The route moves out of the `(auth)` pages,
which would send a request without a browser session to sign-in.
- Embedded sign-in (Microsoft Teams): the photo from Graph with the host
token's access, saved in the embedded session too.
- A sign-in that names no picture reports none and removes the copy.
- Failure handling: a failed picture never blocks sign-in or renewal.
- **Storage:** A new KV namespace, `USER_PICTURES`, bound to the app
runtime.
- Key: organization, issuer hash and subject. Value: the bytes, with
content type, version and check time as metadata.
- Each entry expires 30 days after its last write. People who stop
signing in lose their copy without cleanup code.
- Sign-in and renewal ask the provider at most once a day, whatever it
answered last time. No picture is stored as an entry without bytes; a
failed read rewrites the current copy with the new check time.
- **Serving:** `/oauth2/pictures/{subject}` on app origins.
- The proxy answers after the normal session, renewal and app-access
checks. Everyone who may use the app sees the pictures of the
organization's people.
- It sends `ETag`, `private, no-cache`, `nosniff`, a sandboxing CSP and
`same-origin` resource policy. The request never reaches app code.
- **Identity:** The session identity carries the picture version. Apps
receive `x-auth-request-picture: /oauth2/pictures/{subject}?v={version}`
when the person has one, without a KV read per request.
- **Starters:** `locals.user` / `context.user` gain `picture` (path or
`null`). Local development uses `null`.
- **Bindings:**
- Hosted: provisioning creates `{installation}-user-pictures` and binds
it to the runtime.
- Self-hosted: the agent binds `widefleet-user-pictures` (`runtime.rs`,
`execution.rs`).
- Development: `wrangler.jsonc` declares the binding.
## Documentation
Draft docs PR #411 describes `user.picture` for app creators and the
`User.Read` permission.
## Verification
- `edge/auth-proxy-sessions.test.ts`, run for OIDC and for Entra:
- Signing in through the proxy copies the provider's picture (OIDC on
the issuer origin with the bearer token, Entra through Graph) and
forwards `x-auth-request-picture`.
- The path returns the PNG and answers `304` for its ETag; without a
session it answers `401`.
- `edge/auth-proxy-google.test.ts`: a Workspace app sign-in copies the
picture named in Google's user info and serves it on the app's origin.
- `organization-sso.integration.test.ts`: the access token of
Widefleet's app sign-in reads its own picture through `tokenViewer`, not
another person's; an invalid token reads nothing.
- `packages/auth-proxy/src/picture.test.ts`: the shared fetch rules
(from #407) and the store, which asks at most once a day for a picture,
no picture or a failure.
- `edge/auth-proxy-embedded.test.ts`: embedded sign-in forwards the
copied Graph photo.
- `cloudflare/hosted-installation.test.ts`: the runtime binds
`USER_PICTURES`, the control plane only `AUTH_CONFIG`; provisioning
creates and reuses both namespaces.
- Typecheck, Oxlint and Oxfmt are clean for the control plane, auth
proxy, app runtime and both starters. The vitest suite for
`apps/control-plane` and `packages` passes except
`runtime-errors.integration.test.ts`, which needs a built server and
fails on `main` locally.
- Not run locally: Rust (`cargo` is not installed here), so CI checks
`runtime.rs` and `execution.rs`. The installed self-hosted runtime with
the new namespace is not exercised end to end.
<!-- greptile_comment -->
<!-- greptile_summary -->
<h2><ruby><rp>Confidence Score: 5/5 · The PR appears safe to merge; no
new actionable issues remain.</rp></ruby><a
href="https://app.greptile.com/api/retrigger?id=119742796&sig=d07b89cc4d981b4bff8c1b9dcc46b0d19055e16dab1fcedab98bf0726dd53226"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F409&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>
<!-- greptile-impact-verdict --> The PR appears safe to merge; no new
actionable issues remain.
<details open><summary><h3>Summary</h3></summary>
Apps receive profile pictures through their own origin.
- App sign-ins copy the picture reported by their provider.
- Apps can load organization pictures from their own origin.
- App runtimes receive a separate picture store.
The current code addresses all six previous unnumbered findings. No new
actionable issues were found.
</details>
<details open><summary><h3>Diagram</h3></summary>
```mermaid
sequenceDiagram
participant Provider
participant Proxy as App sign-in proxy
participant KV as USER_PICTURES
participant App
participant Browser
Provider->>Proxy: Verified identity and access token
Proxy->>KV: Read last picture check
opt Daily check is due
Proxy->>Provider: Request picture
Proxy->>KV: Save result and check time
end
Proxy->>App: Forward identity and picture path
Browser->>Proxy: Request picture on app origin
Proxy->>Proxy: Check session and app access
Proxy->>KV: Read picture
Proxy-->>Browser: Picture bytes or 304
```
</details>
<!-- greptile_confidence_score:5 -->
<sub>Reviews (5) · Last reviewed commit: ["Keep the app picture when
user info
disc..."](7ddc76b)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>
<!-- /greptile_comment -->
tnkuehne
force-pushed
the
docs-profile-pictures
branch
from
November 25, 2026 20:25
1a9a64a to
ec338df
Compare
This branch has not been deployed
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.
Documentation for profile pictures from sign-in providers (#407, #409).
user.picturein both starters and how to show it.User.Read.User.Readalso serves each person's photo.#407 and #409 are merged. Draft until a release includes them.