Skip to content

Foss sandbox#30

Merged
UsamaSadiq merged 7 commits into
foss-mainfrom
foss-sandbox
Jun 2, 2026
Merged

Foss sandbox#30
UsamaSadiq merged 7 commits into
foss-mainfrom
foss-sandbox

Conversation

@UsamaSadiq

Copy link
Copy Markdown
Collaborator

hunzlahmalik and others added 4 commits May 18, 2026 14:06
oauth2-proxy was putting the Cognito sub UUID into x-auth-request-user
instead of a human-readable username, so newly-provisioned SSO users
landed with a UUID as their User.name. Drop the header read in the
ForwardAuth middleware and use the email local-part instead — the
same value both apps already fell back to when the header was absent;
we're promoting that fallback to the only source.

Existing users with UUID names are not auto-corrected: the middleware
does not re-sync the name field on subsequent logins.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Hide delete account option when AUTH_TYPE is SSO

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens behavior for ForwardAuth/SSO deployments by disallowing self-service account deletion when AUTH_TYPE is set to SSO, and centralizes the "SSO" sentinel value into a shared constant to avoid scattered string literals across client/server code.

Changes:

  • Introduces AUTH_TYPE_SSO in @shared/constants and replaces hard-coded "SSO" checks with the constant.
  • Blocks self-deletion (and self “request delete”) when running in SSO mode via the server-side User policy.
  • Hides the “Users can delete account” workspace setting in the Security settings UI when in SSO mode, and adds/updates tests to cover the new behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
shared/constants.ts Adds AUTH_TYPE_SSO shared constant for consistent checks across the codebase.
server/routes/api/users/users.test.ts Adds API-level tests ensuring self-deletion and request-delete are forbidden in SSO mode.
server/policies/user.ts Enforces “no self delete in SSO mode” at the authorization layer.
server/policies/user.test.ts Adds policy tests covering default vs SSO delete behavior.
server/middlewares/authentication.ts Replaces local "SSO" constant with the shared AUTH_TYPE_SSO.
server/middlewares/authentication.test.ts Updates ForwardAuth tests to use AUTH_TYPE_SSO.
app/utils/ApiClient.ts Uses AUTH_TYPE_SSO for SSO stale-session/redirect detection logic.
app/stores/AuthStore.ts Uses AUTH_TYPE_SSO for SSO stale-session detection in /auth.info handling.
app/scenes/Settings/Security.tsx Hides the “Users can delete account” setting when AUTH_TYPE indicates SSO mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jawad-khan jawad-khan self-requested a review June 2, 2026 10:07
hunzlahmalik and others added 3 commits June 2, 2026 15:29
A malformed X-Auth-Request-Email with no local part (e.g. "@example.com")
normalises to "@<DEFAULT_EMAIL_DOMAIN>", yielding an empty localPart. Since
User.name enforces a min length of 1, provisioning failed with an opaque
validation error. Source localPart from parseEmail and reject empty local
parts up front with an AuthenticationError for a deterministic failure mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l-local-part

fix(auth): derive SSO display name from email local-part
@UsamaSadiq UsamaSadiq merged commit 6aad17a into foss-main Jun 2, 2026
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants