diff --git a/src/content/docs/build/ecosystem.mdx b/src/content/docs/build/ecosystem.mdx index b77555b..5591b69 100644 --- a/src/content/docs/build/ecosystem.mdx +++ b/src/content/docs/build/ecosystem.mdx @@ -165,7 +165,7 @@ rather than by assembling every piece manually. ## Compatibility Matrix -Versions and declared ranges of each package as of the **v0.23.0** release, **2026-11-08**: the npm +Versions and declared ranges of each package as of the **v0.24.3** release, **2026-12-03**: the npm `latest` tag for npm packages, and the latest GitHub Release for `seamless-auth-api` and `seamless-auth-admin-dashboard`. Ranges are read from the released `package.json`. Every package and the auth API require Node.js 22 or later (`engines.node` is `>=22`), except the messaging @@ -173,23 +173,23 @@ packages, which require Node.js 18 or later. | Package | Latest release | Declares on other Seamless packages | Other peer ranges | | --------------------------------- | -------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | -| `seamless-auth-api` | 0.23.0 | `@seamless-auth/types` ^0.40.0, `@seamless-auth/messaging`, `-aws`, `-twilio` ^0.3.1 | None | -| `@seamless-auth/oidc-provider` | 0.4.1 | `@seamless-auth/express` and `core` ^0.26.0, `@seamless-auth/types` ^0.40.0 | None | -| `@seamless-auth/core` | 0.26.0 | `@seamless-auth/types` ^0.40.0 | None | -| `@seamless-auth/express` | 0.26.0 | `@seamless-auth/core` ^0.26.0 | `express` >=5.0.0 | -| `@seamless-auth/fastify` | 0.17.0 | `@seamless-auth/core` ^0.26.0 | `fastify` >=5.0.0 | -| `@seamless-auth/nextjs` | 0.10.0 | `@seamless-auth/core` ^0.26.0, `@seamless-auth/types` ^0.40.0 | None | -| `@seamless-auth/client` | 0.9.0 | `@seamless-auth/types` ^0.38.0 | None | -| `@seamless-auth/react` | 0.20.0 | `@seamless-auth/client` ^0.9.0, `@seamless-auth/types` ^0.38.0 | `react` and `react-dom` 18 or 19, optional `react-router-dom` 6.4+ or 7.15.1+ | -| `@seamless-auth/angular` | 0.5.0 | `@seamless-auth/client` ^0.9.0 | `@angular/core`, `common`, `router` 20, 21, or 22, and `rxjs` 7 | -| `@seamless-auth/vue` | 0.4.0 | `@seamless-auth/client` ^0.9.0 | `vue` 3.5+, optional `vue-router` 4.4+ or 5 | -| `@seamless-auth/svelte` | 0.4.0 | `@seamless-auth/client` ^0.9.0 | `svelte` 5, optional `@sveltejs/kit` 2.26+ or 3 | -| `@seamless-auth/react-native` | 0.5.0 | `@seamless-auth/client` ^0.9.0, `@seamless-auth/types` ^0.38.0 | `react` 18 or 19 | -| `@seamless-auth/types` | 0.40.0 | None | None | +| `seamless-auth-api` | 0.24.3 | `@seamless-auth/types` ^0.41.0, `@seamless-auth/messaging`, `-aws`, `-twilio` ^0.3.1 | None | +| `@seamless-auth/oidc-provider` | 0.5.1 | `@seamless-auth/express` and `core` ^0.27.0, `@seamless-auth/types` ^0.41.0 | None | +| `@seamless-auth/core` | 0.27.0 | `@seamless-auth/types` ^0.40.0 | None | +| `@seamless-auth/express` | 0.27.0 | `@seamless-auth/core` ^0.27.0 | `express` >=5.0.0 | +| `@seamless-auth/fastify` | 0.18.0 | `@seamless-auth/core` ^0.27.0 | `fastify` >=5.0.0 | +| `@seamless-auth/nextjs` | 0.11.0 | `@seamless-auth/core` ^0.27.0, `@seamless-auth/types` ^0.40.0 | None | +| `@seamless-auth/client` | 0.11.0 | `@seamless-auth/types` ^0.40.0 | None | +| `@seamless-auth/react` | 0.21.0 | `@seamless-auth/client` ^0.11.0, `@seamless-auth/types` ^0.40.0 | `react` and `react-dom` 18 or 19, optional `react-router-dom` 6.4+ or 7.15.1+ | +| `@seamless-auth/angular` | 0.6.0 | `@seamless-auth/client` ^0.11.0 | `@angular/core`, `common`, `router` 20, 21, or 22, and `rxjs` 7 | +| `@seamless-auth/vue` | 0.5.0 | `@seamless-auth/client` ^0.11.0 | `vue` 3.5+, optional `vue-router` 4.4+ or 5 | +| `@seamless-auth/svelte` | 0.5.0 | `@seamless-auth/client` ^0.11.0 | `svelte` 5, optional `@sveltejs/kit` 2.26+ or 3 | +| `@seamless-auth/react-native` | 0.6.0 | `@seamless-auth/client` ^0.11.0, `@seamless-auth/types` ^0.40.0 | `react` 18 or 19 | +| `@seamless-auth/types` | 0.41.0 | None | None | | `@seamless-auth/messaging` | 0.3.1 | `@seamless-auth/types` ^0.34.0 | None | | `@seamless-auth/messaging-aws` | 0.3.1 | `@seamless-auth/messaging` ^0.3.1 | None | | `@seamless-auth/messaging-twilio` | 0.3.1 | `@seamless-auth/messaging` ^0.3.1 | None | -| `seamless-cli` | 0.30.0 | `@seamless-auth/types` ^0.40.0 | None | +| `seamless-cli` | 0.30.4 | `@seamless-auth/types` ^0.41.0 | None | | `seamless-auth-admin-dashboard` | 0.14.0 | `@seamless-auth/react` ^0.19.0, `@seamless-auth/types` ^0.40.0 | None | How to read it: @@ -199,22 +199,26 @@ How to read it: bumped and released. - `@seamless-auth/express`, `fastify`, and `nextjs` declare `@seamless-auth/core` as `workspace:^`, which pnpm rewrites at publish to a caret on the core version in the same release - (`^0.26.0` today). -- `@seamless-auth/types` is split across three minors. The auth API, `oidc-provider`, `core`, - `nextjs`, the CLI and the dashboard declare ^0.40.0. `client`, `react` and `react-native` declare - ^0.38.0, and the messaging packages ^0.34.0. An app that installs packages from more than one + (`^0.27.0` today). +- `@seamless-auth/types` is split across three minors. The auth API, `oidc-provider` and the CLI + declare ^0.41.0. `core`, `nextjs`, `client`, `react`, `react-native` and the dashboard declare + ^0.40.0, and the messaging packages ^0.34.0. An app that installs packages from more than one group gets more than one copy of it. -- `@seamless-auth/oidc-provider` 0.4.0 and 0.4.1 speak OpenID Provider contract version 3, as auth - API 0.22.0 and 0.23.0 do. Run 0.4.1 with native or desktop clients: on 0.4.0 a step-up or second - sign-in shares the first sign-in's grant, so revoking the replaced refresh token ends both. Its `permissions` and `custom_claims` scopes need auth API 0.23.0; against - 0.22.0 those claims are not released. +- `@seamless-auth/oidc-provider` 0.5.0 and later speak OpenID Provider contract version 4, as auth + API 0.24.0 and later do. Each refuses to start against a peer on contract 3 (`oidc-provider` + 0.4.x, auth API 0.22.0 and 0.23.0), so upgrade the two together. Its `permissions` and + `custom_claims` scopes need auth API 0.23.0 or later. +- The cookie `SameSite` default is `lax` from `core` and `express` 0.27.0, `fastify` 0.18.0 and + `nextjs` 0.11.0, and the cross-site guard runs whatever the `SameSite` setting. A browser app on + another site sets `cookieSameSite: 'none'`; see + [Cookies, Sessions, And Tokens](/reference/cookies-sessions-tokens#cookie-attributes). - The adapters' permission guards (`requirePermission` and the framework equivalents) need auth API 0.23.0. Against an older API they deny every request, since no token carries permissions. - The messaging packages are used by `seamless-auth-api` to deliver email and SMS. Your application does not install them. - The auth API exposes an HTTP contract, not a package range. No package declares a range on `seamless-auth-api`, so pair the API and the server SDK from the same release window. -- Auth API 0.23.0 streams audit events over OTLP only. Syslog sinks arrive in 0.23.1 +- Auth API 0.24.0 adds syslog audit sinks next to OTLP; 0.23.0 streams over OTLP only ([How To Stream Audit Events To A SIEM](/operate/stream-audit-events-siem)). ### Python, Go, And Rust Adapters @@ -225,20 +229,20 @@ instead. | Adapter | Latest release | Registry | Needs | | ---------------------------------------- | -------------- | ------------------------------ | -------------------------------------------------------------- | -| `seamless-auth` (Python) | 0.6.0 | PyPI | Python 3.11+, FastAPI 0.115+ or Django 5.2+, auth API v0.18.0+ (permission guards: v0.23.0+) | -| `github.com/fells-code/seamless-auth-go` | v0.6.0 | Go module proxy (tag `v0.6.0`) | Go 1.22+, auth API v0.18.0+ (permission guards: v0.23.0+) | -| `seamless-auth` (Rust) | 0.6.0 | crates.io | Rust 1.88+, Axum 0.8, auth API v0.18.0+ (permission guards: v0.23.0+) | +| `seamless-auth` (Python) | 0.7.0 | PyPI | Python 3.11+, FastAPI 0.115+ or Django 5.2+, auth API v0.18.0+ (permission guards: v0.23.0+) | +| `github.com/fells-code/seamless-auth-go` | v0.7.0 | Go module proxy (tag `v0.7.0`) | Go 1.22+, auth API v0.18.0+ (permission guards: v0.23.0+) | +| `seamless-auth` (Rust) | 0.7.0 | crates.io | Rust 1.88+, Axum 0.8, auth API v0.18.0+ (permission guards: v0.23.0+) | ### What The CLI Scaffolds -`seamless-cli` 0.30.0 does not install the newest of everything. It pins the images and the +`seamless-cli` 0.30.4 does not install the newest of everything. It pins the images and the template tag it scaffolds, so a given CLI version always produces the same project: | What `seamless init` uses | Pinned to | Where it is set | | ------------------------- | -------------------------------------------------------------- | ------------------------------------------------------- | | Auth API image | `ghcr.io/fells-code/seamless-auth-api:v0.23.0` | `seamless-cli` `src/core/images.ts` | | Admin dashboard image | `ghcr.io/fells-code/seamless-auth-admin-dashboard:v0.14.0` | `seamless-cli` `src/core/images.ts` | -| Starter templates | `fells-code/seamless-templates` at `v0.22.0` | `seamless-cli` `src/core/images.ts` | +| Starter templates | `fells-code/seamless-templates` at `v0.22.1` | `seamless-cli` `src/core/images.ts` | | Express API template | `@seamless-auth/express` ^0.25.0 | `templates/api/express/package.json` | | Fastify API template | `@seamless-auth/fastify` ^0.16.0 | `templates/api/fastify/package.json` | | Next.js template | `@seamless-auth/nextjs` ^0.9.0, `@seamless-auth/react` ^0.20.0 | `templates/fullstack/nextjs/package.json` | @@ -251,10 +255,13 @@ template tag it scaffolds, so a given CLI version always produces the same proje | Axum API template | `seamless-auth` 0.6 | `templates/api/axum/Cargo.toml` | | FastAPI API template | `seamless-auth[fastapi]>=0.6,<0.7` | `templates/api/fastapi/pyproject.toml` | -Template paths are inside `fells-code/seamless-templates` at `v0.22.0`. The Express, Fastify and -Next.js templates are one minor behind the server adapters released with v0.23.0, so a new project -gets `verifyWebhook` (`@seamless-auth/core/webhook`, core 0.26.0) only after its adapter range moves -to the 0.26 line (0.17 for Fastify, 0.10 for Next.js). +Template paths are inside `fells-code/seamless-templates` at `v0.22.1`. The CLI still scaffolds auth +API v0.23.0, so a scaffolded stack is on OpenID Provider contract 3 and needs `oidc-provider` 0.4.1, +not 0.5.x. The templates' adapter ranges are behind the current releases: `express` ^0.25.0, +`fastify` ^0.16.0 and `nextjs` ^0.9.0 against 0.27.0, 0.18.0 and 0.11.0, and the Gin, Axum and +FastAPI templates on the 0.6 line against 0.7.0. A new project gets `verifyWebhook` +(`@seamless-auth/core/webhook`, core 0.26.0), the `SameSite=Lax` cookie default and the +Origin-to-`Host` cross-site check only after it moves its adapter range to the current line. ### Keeping This Matrix Current diff --git a/src/content/docs/build/go-adapter.mdx b/src/content/docs/build/go-adapter.mdx index d41783d..60a333c 100644 --- a/src/content/docs/build/go-adapter.mdx +++ b/src/content/docs/build/go-adapter.mdx @@ -18,14 +18,14 @@ is held to the same conformance suite as the Express, Fastify, Python, and Rust languages see [Server SDKs And Adapters](/build/server-sdks). Source: [fells-code/seamless-auth-go](https://github.com/fells-code/seamless-auth-go). Current -release: `v0.2.0` (pre-1.0, so the public API may change between minor versions). +release: `v0.7.0` (pre-1.0, so the public API may change between minor versions). --- ## Install ```bash -go get github.com/fells-code/seamless-auth-go@v0.2.0 +go get github.com/fells-code/seamless-auth-go@v0.7.0 ``` It needs Go 1.22 or later. The package name is `seamlessauth`. @@ -135,8 +135,8 @@ already has them in `.env`. | `Audience` | `AuthServerIssuer` | Expected `aud` of the auth API's tokens | | `CookieDomain` | none | Cookie `Domain` | | `InsecureCookies` | `false` | Drops `Secure`, for local development over plain HTTP on a host other than `localhost` | -| `CookieSameSite` | `None`, or `Lax` with `InsecureCookies` | Cookie `SameSite` | -| `AllowedOrigins` | none | The only cross-origin callers allowed to change state while cookies are `SameSite=None` | +| `CookieSameSite` | `Lax` (from v0.7.0) | Cookie `SameSite`; set `None` for a browser app on another site | +| `AllowedOrigins` | none (the `Origin` must name the request's `Host`) | Origins allowed to make same-site or metadata-free state-changing requests | | `AccessCookieName`, `RefreshCookieName` | `seamless-access`, `seamless-refresh` | Session cookie names | | `RegistrationCookieName`, `PreAuthCookieName` | `seamless-ephemeral` | Sign-in flow cookie names | | `Deliver` | none | Send OTP codes and magic links through your own transports | @@ -185,11 +185,17 @@ The same `/auth` routes serve two contracts: itself, so it works on any route, and it does not refresh. `auth.Authenticate(r)` runs the same check without answering the request (and without the cross-site check below). -While cookies are `SameSite=None`, a state-changing request `RequireAuth` admits on the cookie from -another site (`Sec-Fetch-Site: cross-site`, or an `Origin` outside `AllowedOrigins`) answers 403 -`cross_site_request_blocked`. The auth routes only accept JSON request bodies (`application/json` -or a `+json` type); anything else answers 415 `unsupported_media_type`. The frontend SDKs already -send JSON. +A state-changing request on the auth routes, or one `RequireAuth` admits on the cookie, is checked +for a cross-site origin whatever the `SameSite` setting, because a sibling subdomain is same-site +and a `Lax` cookie still rides its requests. An `Origin` of `null`, `Sec-Fetch-Site: cross-site`, or +a `Sec-Fetch-Site` value the check does not know answers 403 `cross_site_request_blocked`. A +`Sec-Fetch-Site: same-site` request, or one without `Sec-Fetch-Site` that carries an `Origin`, needs +that `Origin` on `AllowedOrigins` when it is set, or naming the request's `Host` when it is not. +Behind a proxy that rewrites `Host`, set `AllowedOrigins`. Before v0.7.0 `CookieSameSite` defaulted +to `None` (`Lax` with `InsecureCookies`). + +The auth routes only accept JSON request bodies (`application/json` or a `+json` type); anything +else answers 415 `unsupported_media_type`. The frontend SDKs already send JSON. See [Bearer Transport For Native Clients](/build/server-sdks#bearer-transport-for-native-clients) for the full contract, which every adapter shares. @@ -208,9 +214,14 @@ and [React Native](/build/react-native-sdk). Browser requests to your own protec ## Version Compatibility -| `seamless-auth-go` | Auth API | Go | -| ------------------ | ---------------- | ----- | -| v0.2.0 | v0.18.0 or later | 1.22+ | +| `seamless-auth-go` | Auth API | Go | +| ------------------ | --------------------------------------------------------- | ----- | +| v0.7.0 | v0.18.0 or later (permission guards: v0.23.0 or later) | 1.22+ | + +v0.7.0 changes the cross-site defaults: `CookieSameSite` defaults to `Lax`, and without +`AllowedOrigins` a state-changing request's `Origin` must name the request's `Host`. If your frontend +is on another origin, list it in `AllowedOrigins`; if it is on another site, also set +`CookieSameSite` to `http.SameSiteNoneMode`. See [Cookie And Bearer Transport](#cookie-and-bearer-transport). Which routes the adapter serves comes from the adapter manifest the auth API publishes at `/.well-known/seamless-adapter.json`, first served by auth API v0.18.0, so a new API route works diff --git a/src/content/docs/build/nextjs.mdx b/src/content/docs/build/nextjs.mdx index f18f3f1..d84b2ec 100644 --- a/src/content/docs/build/nextjs.mdx +++ b/src/content/docs/build/nextjs.mdx @@ -120,8 +120,8 @@ export const DELETE = (request: Request) => seamless().DELETE(request) | `basePath` | `/auth` | Where the catch-all route is mounted | | `cookieDomain` | none | Domain attribute for the auth cookies | | `cookieSecure` | `true` | Set `false` only for local HTTP development | -| `cookieSameSite` | `none` when secure, else `lax` | SameSite policy | -| `allowedOrigins` | none | Origin allowlist for browsers without `Sec-Fetch-Site` | +| `cookieSameSite` | `lax` (from 0.11.0) | SameSite policy; set `none` for a browser app on another site | +| `allowedOrigins` | none (the `Origin` must match `Host`) | Origins allowed to make same-site or metadata-free state-changing requests; see [the guard](/build/server-sdks#cross-site-request-guard) | | `accessCookieName` | `seamless-access` | Session cookie name | | `registrationCookieName` | `seamless-ephemeral` | Registration cookie name | | `refreshCookieName` | `seamless-refresh` | Refresh cookie name | diff --git a/src/content/docs/build/python-adapter.mdx b/src/content/docs/build/python-adapter.mdx index cf7b373..c4f06e2 100644 --- a/src/content/docs/build/python-adapter.mdx +++ b/src/content/docs/build/python-adapter.mdx @@ -18,7 +18,7 @@ managed instance). For Node.js backends see [Server SDKs And Adapters](/build/se and Rust see [Go](/build/go-adapter) and [Rust](/build/rust-adapter). Source: [fells-code/seamless-auth-python](https://github.com/fells-code/seamless-auth-python). -Current release: `0.2.0` (pre-1.0, so the public API may change between minor versions). +Current release: `0.7.0` (pre-1.0, so the public API may change between minor versions). --- @@ -167,8 +167,8 @@ already has them in `.env`. | `audience` | the issuer | Expected `aud` of the auth API's tokens | | `cookie_domain` | none | Cookie `Domain` | | `insecure_cookies` | `False` | Drops `Secure`, for local development over plain HTTP on a host other than `localhost` | -| `same_site` | `None`, or `Lax` with `insecure_cookies` | Cookie `SameSite` | -| `allowed_origins` | none | The only cross-origin callers allowed to change state while cookies are `SameSite=None` | +| `same_site` | `Lax` (from v0.7.0) | Cookie `SameSite`; set `None` for a browser app on another site | +| `allowed_origins` | none (the `Origin` must name the request's `Host`) | Origins allowed to make same-site or metadata-free state-changing requests | | `access_cookie_name`, `refresh_cookie_name` | `seamless-access`, `seamless-refresh` | Session cookie names | | `registration_cookie_name`, `pre_auth_cookie_name` | `seamless-ephemeral` | Sign-in flow cookie names | | `deliver` | none | Send OTP codes and magic links through your own transports | @@ -220,10 +220,17 @@ The guard (`RequireUser`, `require_auth`) accepts either the session cookie or a token in `Authorization: Bearer`, and the cookie wins when both are present. It does not refresh. `Adapter.authenticate(headers)` runs the same check anywhere else. -While cookies are `SameSite=None`, a state-changing request admitted on the cookie from another -site (`Sec-Fetch-Site: cross-site`, or an `Origin` outside `allowed_origins`) answers 403. The -auth routes only accept JSON request bodies (`application/json` or a `+json` type); anything else -answers 415 `unsupported_media_type`. The frontend SDKs already send JSON. +A state-changing request on the auth routes, or one the guard admits on the cookie, is checked for a +cross-site origin whatever the `SameSite` setting, because a sibling subdomain is same-site and a +`Lax` cookie still rides its requests. An `Origin` of `null`, `Sec-Fetch-Site: cross-site`, or a +`Sec-Fetch-Site` value the check does not know answers 403 `cross_site_request_blocked`. A +`Sec-Fetch-Site: same-site` request, or one without `Sec-Fetch-Site` that carries an `Origin`, needs +that `Origin` on `allowed_origins` when it is set, or naming the request's `Host` when it is not. +Behind a proxy that rewrites `Host`, set `allowed_origins`. Before v0.7.0 `same_site` defaulted to +`None` (`Lax` with `insecure_cookies`). + +The auth routes only accept JSON request bodies (`application/json` or a `+json` type); anything +else answers 415 `unsupported_media_type`. The frontend SDKs already send JSON. See [Bearer Transport For Native Clients](/build/server-sdks#bearer-transport-for-native-clients) for the full contract, which every adapter shares. @@ -247,9 +254,15 @@ That is the same for [React](/build/react-sdk), [Angular](/build/angular-sdk), ## Version Compatibility -| `seamless-auth` (PyPI) | Auth API | Python | Frameworks | -| ---------------------- | --------------------- | ------ | ----------------------------------- | -| 0.2.0 | v0.18.0 or later | 3.11+ | FastAPI 0.115+, Django 5.2+ | +| `seamless-auth` (PyPI) | Auth API | Python | Frameworks | +| ---------------------- | ------------------------------------------------------ | ------ | --------------------------- | +| 0.7.0 | v0.18.0 or later (permission guards: v0.23.0 or later) | 3.11+ | FastAPI 0.115+, Django 5.2+ | + +0.7.0 changes the cross-site defaults: `same_site` defaults to `Lax`, and without `allowed_origins` a +state-changing request's `Origin` must name the request's `Host`. If your frontend is on another +origin, or a proxy rewrites `Host`, list the frontend's origin in `allowed_origins`; if it is on +another site, also pass `same_site="None"`. See [Cookie And Bearer +Transport](#cookie-and-bearer-transport). Which routes the adapter serves comes from the adapter manifest the auth API publishes at `/.well-known/seamless-adapter.json`, first served by auth API v0.18.0, so a new API route works diff --git a/src/content/docs/build/rust-adapter.mdx b/src/content/docs/build/rust-adapter.mdx index 2cedfae..87619dc 100644 --- a/src/content/docs/build/rust-adapter.mdx +++ b/src/content/docs/build/rust-adapter.mdx @@ -17,7 +17,7 @@ is held to the same conformance suite as the Express, Fastify, Go, and Python ad languages see [Server SDKs And Adapters](/build/server-sdks). Source: [fells-code/seamless-auth-rust](https://github.com/fells-code/seamless-auth-rust). Current -release: `0.2.0` (pre-1.0, so the public API may change between minor versions). +release: `0.7.0` (pre-1.0, so the public API may change between minor versions). --- @@ -122,8 +122,8 @@ The builder also has: | `audience` | the issuer | Expected `aud` of the auth API's tokens | | `cookie_domain` | none | Cookie `Domain` | | `insecure_cookies` | `false` | Drops `Secure`, for local development over plain HTTP on a host other than `localhost` | -| `same_site` | `None`, or `Lax` with `insecure_cookies` | Cookie `SameSite` | -| `allowed_origins` | none | The only cross-origin callers allowed to change state while cookies are `SameSite=None` | +| `same_site` | `Lax` (from v0.7.0) | Cookie `SameSite`; set `None` for a browser app on another site | +| `allowed_origins` | none (the `Origin` must name the request's `Host`) | Origins allowed to make same-site or metadata-free state-changing requests | | `session_cookie_names` | `seamless-access`, `seamless-refresh` | Session cookie names | | `flow_cookie_names` | `seamless-ephemeral` | Sign-in flow cookie names | | `deliver` | none | Send OTP codes and magic links through your own transports | @@ -176,11 +176,17 @@ The same `/auth` routes serve two contracts: itself, so it works on any route, and it does not refresh. `auth.authenticate(&headers)` runs the same check without answering the request. -While cookies are `SameSite=None`, a state-changing request the guard admits on the cookie from -another site (`Sec-Fetch-Site: cross-site`, or an `Origin` outside `allowed_origins`) answers 403 -`cross_site_request_blocked`. The auth routes only accept JSON request bodies (`application/json` -or a `+json` type); anything else answers 415 `unsupported_media_type`. The frontend SDKs already -send JSON. +A state-changing request on the auth routes, or one the guard admits on the cookie, is checked for a +cross-site origin whatever the `SameSite` setting, because a sibling subdomain is same-site and a +`Lax` cookie still rides its requests. An `Origin` of `null`, `Sec-Fetch-Site: cross-site`, or a +`Sec-Fetch-Site` value the check does not know answers 403 `cross_site_request_blocked`. A +`Sec-Fetch-Site: same-site` request, or one without `Sec-Fetch-Site` that carries an `Origin`, needs +that `Origin` on `allowed_origins` when it is set, or naming the request's `Host` when it is not. +Behind a proxy that rewrites `Host`, set `allowed_origins`. Before v0.7.0 `same_site` defaulted to +`None` (`Lax` with `insecure_cookies`). + +The auth routes only accept JSON request bodies (`application/json` or a `+json` type); anything +else answers 415 `unsupported_media_type`. The frontend SDKs already send JSON. See [Bearer Transport For Native Clients](/build/server-sdks#bearer-transport-for-native-clients) for the full contract, which every adapter shares. @@ -199,9 +205,15 @@ and [React Native](/build/react-native-sdk). Browser requests to your own protec ## Version Compatibility -| `seamless-auth` (crates.io) | Auth API | Rust | Axum | -| --------------------------- | ---------------- | ----- | ---- | -| 0.2.0 | v0.18.0 or later | 1.88+ | 0.8 | +| `seamless-auth` (crates.io) | Auth API | Rust | Axum | +| --------------------------- | ------------------------------------------------------ | ----- | ---- | +| 0.7.0 | v0.18.0 or later (permission guards: v0.23.0 or later) | 1.88+ | 0.8 | + +0.7.0 changes the cross-site defaults: `same_site` defaults to `Lax`, and without `allowed_origins` a +state-changing request's `Origin` must name the request's `Host`. If your frontend is on another +origin, or a proxy rewrites `Host`, list the frontend's origin in `allowed_origins`; if it is on +another site, also call `.same_site(SameSite::None)`. See [Cookie And Bearer +Transport](#cookie-and-bearer-transport). Which routes the adapter serves comes from the adapter manifest the auth API publishes at `/.well-known/seamless-adapter.json`, first served by auth API v0.18.0, so a new API route works diff --git a/src/content/docs/build/server-sdks.mdx b/src/content/docs/build/server-sdks.mdx index b369ee9..e90ed07 100644 --- a/src/content/docs/build/server-sdks.mdx +++ b/src/content/docs/build/server-sdks.mdx @@ -127,22 +127,42 @@ Optional values: | `jwksKid` | `dev-main`, with a startup warning | `kid` header on the HS256 service tokens the adapter signs, not the auth API's signing key ID; set it explicitly in production | | `cookieDomain` | unset | Domain attribute for adapter cookies | | `cookieSecure` | `true` | Secure attribute; set `false` only for local HTTP | -| `cookieSameSite` | `none` if secure, else `lax` | SameSite attribute for adapter cookies | -| `allowedOrigins` | unset | Origin allowlist for browsers without `Sec-Fetch-Site` | +| `cookieSameSite` | `lax` | SameSite attribute for adapter cookies; set `none` for a browser app on another site | +| `allowedOrigins` | unset (the `Origin` must match `Host`) | Origins allowed to make same-site or metadata-free state-changing requests | | `resolveClientIp` | Express `trust proxy` hops | End-user IP forwarded to the auth API | | `messaging` | unset | Deliver auth email and SMS from the adapter | -`allowedOrigins` feeds the adapter's cross-site request guard, which only runs when cookies are -`SameSite=None` and only for state-changing methods (not `GET`, `HEAD`, or `OPTIONS`). The guard -rejects `Sec-Fetch-Site: cross-site` with `403 { "error": "cross_site_request_blocked" }`; when a -browser omits that header, the `Origin` must match an entry (case-insensitive), and with -`allowedOrigins` unset those requests are allowed. +`cookieSameSite` defaults to `lax` from `@seamless-auth/express` 0.27.0, `@seamless-auth/fastify` +0.18.0, and `@seamless-auth/nextjs` 0.11.0. Earlier versions defaulted it to `none` when +`cookieSecure` was on. Custom cookie names are also accepted (`accessCookieName`, `registrationCookieName`, `refreshCookieName`, `preAuthCookieName`). The Fastify `seamlessAuth` plugin takes the same options, `authServerIssuer` included. +### Cross-site request guard + +`allowedOrigins` feeds the adapter's cross-site request guard. The guard runs on the auth routes and +on `requireAuth` and the role guards for cookie sessions, for state-changing methods only (not +`GET`, `HEAD`, or `OPTIONS`), whatever the `SameSite` setting: a sibling subdomain is same-site, so +a `Lax` cookie still rides its requests. A refused request answers +`403 { "error": "cross_site_request_blocked" }`. + +- An `Origin` of `null` is always refused. +- `Sec-Fetch-Site: same-origin` passes. `cross-site`, or any value the Fetch Metadata spec does not + define, is refused. +- `Sec-Fetch-Site: same-site` needs an `Origin` that matches. A `same-site` request with no + `Origin` is refused. +- With `Sec-Fetch-Site: none` or no `Sec-Fetch-Site` at all, a request without an `Origin` passes + (a non-browser caller), and one with an `Origin` needs it to match. + +An `Origin` matches when it is in `allowedOrigins` (case-insensitive) or, with `allowedOrigins` +unset, when its host equals the request's `Host`. Express and Fastify read the host from +`req.host`, which follows `X-Forwarded-Host` only behind a proxy the framework is told to trust +(`trust proxy`, `trustProxy`); Next.js reads the `Host` header. If your browser app is on a +different host than the adapter, or a proxy rewrites `Host`, set `allowedOrigins`. + ### Auth server issuer The adapter checks the `iss` of every token and signed response the auth server returns against @@ -411,7 +431,7 @@ Current versions and the ranges each adapter declares on `@seamless-auth/core` a [Compatibility Matrix](/build/ecosystem#compatibility-matrix). The Python, Go, and Rust adapters are separate repositories (`seamless-auth-python`, -`seamless-auth-go`, `seamless-auth-rust`), released at 0.2.0 and also pre-1.0. They take their route +`seamless-auth-go`, `seamless-auth-rust`), released at 0.7.0 and also pre-1.0. They take their route list from the adapter manifest the auth API serves from v0.18.0, and each runs the same conformance suite in CI. Their api starters (`gin`, `axum`, `fastapi`) are on `seamless-templates` `main` and not yet in a templates release the CLI pins. diff --git a/src/content/docs/reference/cookies-sessions-tokens.mdx b/src/content/docs/reference/cookies-sessions-tokens.mdx index 155ea78..deaf53b 100644 --- a/src/content/docs/reference/cookies-sessions-tokens.mdx +++ b/src/content/docs/reference/cookies-sessions-tokens.mdx @@ -60,19 +60,30 @@ createSeamlessAuthServer({ ## Cookie Attributes -The Express adapter sets cookies as: - -| Attribute | Current behavior | -| ---------- | ---------------------------------------------- | -| `httpOnly` | Always true | -| `path` | `/` | -| `domain` | `cookieDomain` option, if provided | -| `maxAge` | Token TTL returned by the auth API | -| `secure` | true when `NODE_ENV=production` | -| `sameSite` | `none` in production, `lax` outside production | - -For cross-site browser deployments, use HTTPS and set a cookie domain that matches the frontend/API -shape you are deploying. +The Node adapters (`@seamless-auth/express`, `@seamless-auth/fastify`, and `@seamless-auth/nextjs`) +set cookies as: + +| Attribute | Current behavior | +| ---------- | ------------------------------------------------------------------- | +| `httpOnly` | Always true | +| `path` | `/` | +| `domain` | `cookieDomain` option, if provided | +| `maxAge` | Token TTL returned by the auth API | +| `secure` | `cookieSecure` option, default `true` whatever `NODE_ENV` is | +| `sameSite` | `cookieSameSite` option, default `lax` whatever `cookieSecure` is | + +`NODE_ENV` does not change either attribute. Set `cookieSecure: false` only for local development +over plain HTTP. + +The `lax` default applies from `@seamless-auth/express` 0.27.0, `@seamless-auth/fastify` 0.18.0, +and `@seamless-auth/nextjs` 0.11.0 (`@seamless-auth/core` 0.27.0). Earlier versions defaulted +`sameSite` to `none` when the cookie was secure and to `lax` otherwise. The Go, Python, and Rust +adapters default to `Lax` from v0.7.0. + +If your browser app is served from a different site than the adapter, a `Lax` cookie is not sent on +its cross-site requests. Set `cookieSameSite: 'none'` (with `cookieSecure` left on), set a cookie +domain that matches the frontend/API shape you are deploying, and list the app's origins in +`allowedOrigins`. ---