Repository navigation
feat(saml): add dedicated_scope option for SAML providers - #2893
Merged
Merged
Conversation
Lets a SAML SSO provider opt into using its own provider ID as part of its ACS URL and entity ID (which defaults to the SP metadata URL), instead of the URLs shared by every SAML provider in the project. The same signing key is still used. This is useful for IdPs that require a unique ACS URL/entity ID per connection, and isolates assertions issued for one connection from being replayed against another. Co-Authored-By: Claude Sonnet 5 <[email protected]>
hf
commented
Oct 30, 2026
Co-Authored-By: Claude Sonnet 5 <[email protected]>
The dedicated-scope guard in the ACS handler previously ran before ParseResponse, using the SSO provider resolved from an unauthenticated Issuer peeked out of the raw, unverified SAMLResponse XML in the IdP-initiated flow. Move that guard to after the assertion has been cryptographically validated, and require IdP-initiated requests on a dedicated-scope endpoint to carry an explicit, matching Destination rather than relying on the library's conditional check. Also log a WARN with the old/new value whenever dedicated_scope is toggled on an existing provider via the admin API, since it immediately changes the ACS URL/entity ID that provider expects. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
Author
|
Addressed the security review findings on the
|
dedicated_scope effectively changes the entity ID this SP presents to the IdP (it defaults to the SP metadata URL, which becomes scoped to the provider's ID when enabled), so toggling it after the IdP has been configured would silently break the connection. Reject any attempt to change it on an existing provider with a clear error instead. Also move the column from sso_providers to saml_providers: it's a SAML-protocol detail (alongside entity_id/metadata_url/name_id_format) rather than provider-agnostic config like resource_id/disabled, and it's now exposed nested under `saml` in the admin API response to match. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Previously the explicit Destination check was only enforced on dedicated-scope ACS endpoints. Generalize it to every IdP-initiated response so the global, shared ACS endpoint doesn't implicitly accept assertions meant for another endpoint, asserting the invariant ourselves rather than relying solely on crewjam/saml's internal Recipient check. Co-Authored-By: Claude Sonnet 5 <[email protected]>
staaldraad
approved these changes
Nov 4, 2026
Destination is optional per the SAML spec and many real IdPs omit it, especially for IdP-initiated flows. Only reject when an explicit Destination is present and doesn't match this endpoint's ACS URL; an absent Destination no longer blocks the flow. Co-Authored-By: Claude Sonnet 5 <[email protected]>
cemalkilic
approved these changes
Nov 6, 2026
cemalkilic
added a commit
that referenced
this pull request
Nov 6, 2026
…2909) ## What Adds `GO-2026-6909` to the `vulncheck-filter` ignore map so `make vulncheck` passes again. It currently fails on every branch (e.g. #2893). ## Why it's safe to ignore [GO-2026-6909](https://pkg.go.dev/vuln/GO-2026-6909) affects `github.com/crewjam/saml` through v0.5.1, and **there's no upstream fix**. We're on v0.4.14, reached via `handleSamlAcs → ServiceProvider.ParseResponse`. The advisory covers two issues, and both need an assertion signed by an IdP we already trust: 1. **Nil `assertion.Issuer` dereference** in `validateAssertion`. It panics only after signature verification. The `recoverer` middleware (`internal/api/api.go`) catches the panic, so the result is a 500 for that one request, not a process crash. 2. **Namespace-blind `Subject.NameID`**. We read `NameID` in `SAMLAssertion.SubjectID()` only when the `subject-id` attribute is missing. Exploiting it would need the IdP itself to sign an assertion that leaves out `<saml:NameID>` and includes a foreign-namespace `<NameID>`. An attacker can't inject that element without breaking the signature. Remove this entry once crewjam/saml ships a fix. ## Verification - `go test ./hack/vulncheck-filter` passes - `govulncheck ./... | go run ./hack/vulncheck-filter` exits 0
This was referenced Nov 8, 2026
jclab-joseph
added a commit
to dilion-io/dilion
that referenced
this pull request
Nov 10, 2026
Upstream supabase/auth#2893, documented in the openapi.yaml synced at bfbe078. Some IdPs, notably Entra, allow only one application per SP entity ID, so a project could connect to such an IdP only once. A provider created with `dedicated_scope: true` gets SP URLs of its own: shared: /sso/saml/metadata (entity ID), /sso/saml/acs dedicated: /sso/{id}/saml/metadata, /sso/{id}/saml/acs The key pair is the same. The flag can be set on create only: changing it would change the entity ID the IdP was configured with, so an update carrying it is a 400 (migration 0123 adds the column). - POST /sso builds the AuthnRequest with the provider's scope. - /sso/{id}/saml/metadata answers only for a dedicated-scope provider. - The ACS validates the assertion against the scope of the URL it was posted to. Only after validation does it require the provider to own that scope: a dedicated provider its own endpoint, any other the shared one. So an assertion validated for one connection cannot sign in through another. - Like upstream, an IdP-initiated Response whose Destination names another ACS is refused before parsing. The tests sign in on each endpoint. Each cross-scope assertion is signed for the ACS it is posted to, so it validates, and must still be refused. Removing the ownership check makes the first of them sign in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 tasks done
cstockton
pushed a commit
that referenced
this pull request
Nov 16, 2026
🤖 I have created a release *beep* *boop* --- ## [2.198.0](v2.197.0...v2.198.0) (2026-11-13) ### Features * clear existing password on recover ([#2887](#2887)) ([a7e97d6](a7e97d6)) * **mfa:** add recovery codes unenroll guards ([#2787](#2787)) ([4b5069b](4b5069b)) * min password length uses runes, not bytes ([#2879](#2879)) ([d7955e9](d7955e9)) * **openapi:** document mfa recovery codes endpoints ([2773ca5](2773ca5)) * **otp:** add link_token_hash column to one_time_tokens table ([#2800](#2800)) ([4148d39](4148d39)) * **otp:** add one_time_tokens query helpers ([#2797](#2797)) ([f8520b4](f8520b4)) * **otp:** handle test OTPs and Twilio Verify on the one_time_tokens path ([#2798](#2798)) ([2e9ce6c](2e9ce6c)) * **otp:** switch one_time_tokens table to source of truth ([#2788](#2788)) ([2c2acf6](2c2acf6)) * **otp:** write `expires_at` when creating `one_time_tokens` ([#2766](#2766)) ([d7d6afd](d7d6afd)) * **saml:** add dedicated_scope option for SAML providers ([#2893](#2893)) ([bfbe078](bfbe078)) ### Bug Fixes * allow OAuth client tokens on GET /user, keep modifying actions blocked ([#2926](#2926)) ([3e79d85](3e79d85)) * assert password is rejected after magic link/OTP ([#2896](#2896)) ([9eb0924](9eb0924)) * **deps:** bump go to 1.27.3 to distrust compromised x509 intermediates ([a8d7070](a8d7070)) * **deps:** bump go to 1.27.4 to fix net/http server crash ([#2922](#2922)) ([8872586](8872586)) * **deps:** bump google.golang.org/grpc to v1.83.1 for vulncheck ([#2818](#2818)) ([8861440](8861440)) * **deps:** bump otel to v1.45.0 for vulncheck ([946e3e3](946e3e3)) * **deps:** bump x/net to v0.60.0 for http2 vulns ([c3348e8](c3348e8)) * **linkedin:** avoid panic when the email response has no elements ([6311d50](6311d50)) * make password re-encryption on sign-in conditional ([#2906](#2906)) ([84ff0c0](84ff0c0)) * **mfa:** ignore verify-disabled factors in recovery codes guard ([#2824](#2824)) ([79ad7b2](79ad7b2)) * **mfa:** regenerate duplicate recovery codes ([#2793](#2793)) ([8be2691](8be2691)) * **models:** exclude oauth client sessions from mfa step-up invalidation ([#2801](#2801)) ([#2802](#2802)) ([ae468ca](ae468ca)) * only trigger after-user-created hook on account creation ([#2656](#2656)) ([64cfdf2](64cfdf2)) * **openapi:** use ErrorSchema for identity unlink 401/403 responses ([60d4bb6](60d4bb6)) * **passkeys:** count friendly_name length by runes, not bytes ([ce9a8ee](ce9a8ee)) * restrict OAuth client access tokens to OAuth endpoints ([#2898](#2898)) ([384d83a](384d83a)) * **sessions:** invalidate legacy sessions with null aal ([#2792](#2792)) ([8977629](8977629)) * **tools:** bump staticcheck to read go 1.27.3 export data ([9e4f25b](9e4f25b)) * Update user password on each valid signup attempt ([#2868](#2868)) ([004f767](004f767)) * Update user password on each valid signup attempt (fixed) ([#2918](#2918)) ([2550341](2550341)) * **vulncheck:** ignore GO-2026-6909 (crewjam/saml, no fix available) ([#2909](#2909)) ([bc90ec9](bc90ec9)) ### Reverts * Update user password on each valid signup attempt ([#2912](#2912)) ([35307ce](35307ce)) * Update user password on each valid signup attempt (fixed) [#2918](#2918) ([#2921](#2921)) ([1357a5b](1357a5b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
This was referenced Nov 17, 2026
hf
added a commit
to supabase/supabase
that referenced
this pull request
Nov 23, 2026
## What Documents the SAML \`dedicated_scope\` option added in [supabase/auth#2893](supabase/auth#2893) and exposed in the CLI in [supabase/cli#7665](supabase/cli#7665). Some identity providers, notably Microsoft Entra, don't allow the same entity ID in more than one application, so a project could connect only one such app. A provider with a dedicated scope gets its own entity ID, metadata URL, and ACS URL scoped to its provider ID. ## Changes - `auth-sso-saml.mdx`: new "Use a dedicated scope for a connection" section with the URL comparison, the `--dedicated-scope` flag, which commands print the dedicated URLs, and a setup procedure for identity providers (such as Okta) that need the URLs when the app is created. The shared-URL table now links to it. - `cli_v1_commands.yaml`: adds `--dedicated-scope` to `supabase sso add`. ## Needs review - The Entra-specific flow isn't verified. The procedure follows the Okta workflow generically; it's unclear whether Entra rejects a second app created with the shared entity ID. - "Remove and add the connection again" to change scope is inferred, because `sso update` doesn't accept the flag. - No minimum CLI or Auth version is stated. - The generated Management API reference isn't updated, since the published spec doesn't document `dedicated_scope` yet. - The self-hosted SAML page isn't checked. - Not run: docs build, link and anchor checks, `test-the-docs`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
sundeep8967
pushed a commit
to sundeep8967/cli
that referenced
this pull request
Nov 23, 2026
Adds a `--dedicated-scope` flag to `supabase sso add`, which sets the SAML `dedicated_scope` option so the provider gets its own entity ID, metadata URL and ACS URL. - The field is create-only, so `sso update` does not accept it. - `saml.dedicated_scope` is included in provider output (`sso show`, `sso list`, and the json/yaml/toml formats). - `sso show`, `add`, `remove` and `update` print the provider's own ACS URL and entity ID in the text table when its scope is dedicated. `update` takes the scope from the provider it fetches first, since its response omits the field. - `sso info` is unchanged. - The Management API spec gets the field through `openapi-overrides.json` until the published spec documents it. Related: supabase/auth#2893, supabase/platform#42021 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Some SAML identity providers (famously Entra) don't allow the same entity ID to be registered with multiple "applications," making Supabase Auth usable only with one application. Some enterprise use-cases are therefore hard to build.
In this PR we add a
dedicated_scopeoptional boolean on an SSO provider, which in SAML means that the provider can only be used via its own new Entity ID and URLs scoped to the provider's unique ID.This way in Entra you can register many SPs served by the same Supabase Auth project by creating them with the
dedicated_scopeboolean.Notes:
dedicated_scopeboolean to SAML SSO providers. When set, that provider's ACS URL and SP metadata URL (and, by extension, the entity ID GoTrue presents to the IdP, which defaults to the metadata URL) are scoped to the provider's own ID, instead of using the URLs shared by every SAML provider in the project. The same signing key/certificate is still used.GET /sso/{sso_provider_id}/saml/metadataandPOST /sso/{sso_provider_id}/saml/acsalongside the existing shared/sso/saml/*endpoints; the ACS handler rejects a provider hitting the wrong endpoint for its scope setting.dedicated_scopecan be set on create/update via the admin SSO provider API and is documented inopenapi.yaml.