From 9c7fb53e983e4d3d65142e59ed5c2e8f0e131eac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:30:42 +0000 Subject: [PATCH] Version Packages --- .changeset/concurrent-refresh-replay.md | 5 ---- .changeset/csrf-origin-host.md | 19 -------------- .changeset/guard-jwks-verify.md | 15 ----------- packages/core/CHANGELOG.md | 30 ++++++++++++++++++++++ packages/core/package.json | 2 +- packages/express/CHANGELOG.md | 33 +++++++++++++++++++++++++ packages/express/package.json | 2 +- packages/fastify/CHANGELOG.md | 33 +++++++++++++++++++++++++ packages/fastify/package.json | 2 +- packages/nextjs/CHANGELOG.md | 24 ++++++++++++++++++ packages/nextjs/package.json | 2 +- 11 files changed, 124 insertions(+), 43 deletions(-) delete mode 100644 .changeset/concurrent-refresh-replay.md delete mode 100644 .changeset/csrf-origin-host.md delete mode 100644 .changeset/guard-jwks-verify.md diff --git a/.changeset/concurrent-refresh-replay.md b/.changeset/concurrent-refresh-replay.md deleted file mode 100644 index 5e6f97a..0000000 --- a/.changeset/concurrent-refresh-replay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@seamless-auth/core": patch ---- - -Document multi-instance deployment and test that two adapter instances refreshing the same cookie at once both succeed with the same refresh cookie, and that `refresh_token_reused` clears the cookies without a retry. Needs the auth API release that ships the refresh replay window (fells-code/seamless-auth-api#613). diff --git a/.changeset/csrf-origin-host.md b/.changeset/csrf-origin-host.md deleted file mode 100644 index ae05c18..0000000 --- a/.changeset/csrf-origin-host.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -"@seamless-auth/core": minor -"@seamless-auth/express": minor -"@seamless-auth/fastify": minor -"@seamless-auth/nextjs": minor ---- - -Tighten cross-site request protection when no `allowedOrigins` list is configured, and default the auth cookies to `SameSite=Lax`. - -Behaviour changes: - -- Without `allowedOrigins`, a state-changing request that is `Sec-Fetch-Site: same-site`, or that carries an `Origin` and no `Sec-Fetch-Site` (or `none`), must come from an `Origin` whose host equals the request's `Host`. It used to pass, so a page on a sibling subdomain could send a request that carried the session cookie. A `same-site` request with no `Origin` is now refused. Refusals answer `403 {"error":"cross_site_request_blocked"}`. This applies to the auth routes and to the `requireAuth` and role guards on cookie sessions. -- A `Sec-Fetch-Site` value the Fetch Metadata spec does not define is treated as cross-site and refused. -- `cookieSameSite` now defaults to `lax` whatever `cookieSecure` says. It used to default to `none` when the cookie was secure. -- `checkOrigin` in core takes a new `host` input. Without `allowedOrigins`, a caller that leaves it out has every request with a non-same-origin `Origin` refused. - -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. - -What to do when upgrading: if your browser app is served from a different host than the adapter, or a proxy in front of the adapter rewrites `Host`, set `allowedOrigins` to the origins your app is served from (or configure the framework to trust the proxy). If your browser app is on a different site from the adapter, set `cookieSameSite: "none"` (with `cookieSecure` left on) to keep the cookie on its requests. diff --git a/.changeset/guard-jwks-verify.md b/.changeset/guard-jwks-verify.md deleted file mode 100644 index 0342e02..0000000 --- a/.changeset/guard-jwks-verify.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -"@seamless-auth/core": minor -"@seamless-auth/express": minor -"@seamless-auth/fastify": minor ---- - -Verify the access token inside a session cookie against the auth API's JWKS in the Express and Fastify guards, and take the session's roles, permissions and organization from it alone. - -Behaviour changes: - -- `requireAuth` in `@seamless-auth/express` and `@seamless-auth/fastify` now requires `authServerUrl` and `audience`, and throws when it is constructed without them. The types mark both as required. Before, leaving them out gave a cookie-only guard that trusted the cookie's payload, so anyone holding `cookieSecret` could sign a cookie with any identity, roles or permissions. The Next.js guards already worked this way. -- With the pair set, the guard verifies the cookie's inner access token (issuer, audience, expiry, `typ: "access"`) and refuses the cookie when it does not verify or its `sub` differs from the token's. It also accepts the auth API's access token as `Authorization: Bearer`, as it already did when the pair was configured. -- `req.user.roles` (and `request.user.roles`) is the verified token's `roles` claim, or `[]` when the token has none. It no longer falls back to the roles copied into the cookie from the login response. `permissions`, `organizationRoles`, `organizationPermissions` and `organizationId` come from the verified token too. - -What to do when upgrading: pass the same `authServerUrl` and `audience` you give `createSeamlessAuthServer` (or the plugin) to every `requireAuth`, plus `authServerIssuer` if you set one there. The guard fetches the auth API's JWKS once and caches it. diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 8241f6f..2840ad4 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,35 @@ # @seamless-auth/core +## 0.27.0 + +### Minor Changes + +- 193298a: Tighten cross-site request protection when no `allowedOrigins` list is configured, and default the auth cookies to `SameSite=Lax`. + + Behaviour changes: + + - Without `allowedOrigins`, a state-changing request that is `Sec-Fetch-Site: same-site`, or that carries an `Origin` and no `Sec-Fetch-Site` (or `none`), must come from an `Origin` whose host equals the request's `Host`. It used to pass, so a page on a sibling subdomain could send a request that carried the session cookie. A `same-site` request with no `Origin` is now refused. Refusals answer `403 {"error":"cross_site_request_blocked"}`. This applies to the auth routes and to the `requireAuth` and role guards on cookie sessions. + - A `Sec-Fetch-Site` value the Fetch Metadata spec does not define is treated as cross-site and refused. + - `cookieSameSite` now defaults to `lax` whatever `cookieSecure` says. It used to default to `none` when the cookie was secure. + - `checkOrigin` in core takes a new `host` input. Without `allowedOrigins`, a caller that leaves it out has every request with a non-same-origin `Origin` refused. + + 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. + + What to do when upgrading: if your browser app is served from a different host than the adapter, or a proxy in front of the adapter rewrites `Host`, set `allowedOrigins` to the origins your app is served from (or configure the framework to trust the proxy). If your browser app is on a different site from the adapter, set `cookieSameSite: "none"` (with `cookieSecure` left on) to keep the cookie on its requests. +- c835725: Verify the access token inside a session cookie against the auth API's JWKS in the Express and Fastify guards, and take the session's roles, permissions and organization from it alone. + + Behaviour changes: + + - `requireAuth` in `@seamless-auth/express` and `@seamless-auth/fastify` now requires `authServerUrl` and `audience`, and throws when it is constructed without them. The types mark both as required. Before, leaving them out gave a cookie-only guard that trusted the cookie's payload, so anyone holding `cookieSecret` could sign a cookie with any identity, roles or permissions. The Next.js guards already worked this way. + - With the pair set, the guard verifies the cookie's inner access token (issuer, audience, expiry, `typ: "access"`) and refuses the cookie when it does not verify or its `sub` differs from the token's. It also accepts the auth API's access token as `Authorization: Bearer`, as it already did when the pair was configured. + - `req.user.roles` (and `request.user.roles`) is the verified token's `roles` claim, or `[]` when the token has none. It no longer falls back to the roles copied into the cookie from the login response. `permissions`, `organizationRoles`, `organizationPermissions` and `organizationId` come from the verified token too. + + What to do when upgrading: pass the same `authServerUrl` and `audience` you give `createSeamlessAuthServer` (or the plugin) to every `requireAuth`, plus `authServerIssuer` if you set one there. The guard fetches the auth API's JWKS once and caches it. + +### Patch Changes + +- f24a5a1: Document multi-instance deployment and test that two adapter instances refreshing the same cookie at once both succeed with the same refresh cookie, and that `refresh_token_reused` clears the cookies without a retry. Needs the auth API release that ships the refresh replay window (fells-code/seamless-auth-api#613). + ## 0.26.0 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index 47d2112..1dabb24 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@seamless-auth/core", - "version": "0.26.0", + "version": "0.27.0", "description": "Framework-agnostic core authentication logic for SeamlessAuth", "keywords": [ "authentication", diff --git a/packages/express/CHANGELOG.md b/packages/express/CHANGELOG.md index 137ef69..d2b8c44 100644 --- a/packages/express/CHANGELOG.md +++ b/packages/express/CHANGELOG.md @@ -1,5 +1,38 @@ # @seamless-auth/express +## 0.27.0 + +### Minor Changes + +- 193298a: Tighten cross-site request protection when no `allowedOrigins` list is configured, and default the auth cookies to `SameSite=Lax`. + + Behaviour changes: + + - Without `allowedOrigins`, a state-changing request that is `Sec-Fetch-Site: same-site`, or that carries an `Origin` and no `Sec-Fetch-Site` (or `none`), must come from an `Origin` whose host equals the request's `Host`. It used to pass, so a page on a sibling subdomain could send a request that carried the session cookie. A `same-site` request with no `Origin` is now refused. Refusals answer `403 {"error":"cross_site_request_blocked"}`. This applies to the auth routes and to the `requireAuth` and role guards on cookie sessions. + - A `Sec-Fetch-Site` value the Fetch Metadata spec does not define is treated as cross-site and refused. + - `cookieSameSite` now defaults to `lax` whatever `cookieSecure` says. It used to default to `none` when the cookie was secure. + - `checkOrigin` in core takes a new `host` input. Without `allowedOrigins`, a caller that leaves it out has every request with a non-same-origin `Origin` refused. + + 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. + + What to do when upgrading: if your browser app is served from a different host than the adapter, or a proxy in front of the adapter rewrites `Host`, set `allowedOrigins` to the origins your app is served from (or configure the framework to trust the proxy). If your browser app is on a different site from the adapter, set `cookieSameSite: "none"` (with `cookieSecure` left on) to keep the cookie on its requests. +- c835725: Verify the access token inside a session cookie against the auth API's JWKS in the Express and Fastify guards, and take the session's roles, permissions and organization from it alone. + + Behaviour changes: + + - `requireAuth` in `@seamless-auth/express` and `@seamless-auth/fastify` now requires `authServerUrl` and `audience`, and throws when it is constructed without them. The types mark both as required. Before, leaving them out gave a cookie-only guard that trusted the cookie's payload, so anyone holding `cookieSecret` could sign a cookie with any identity, roles or permissions. The Next.js guards already worked this way. + - With the pair set, the guard verifies the cookie's inner access token (issuer, audience, expiry, `typ: "access"`) and refuses the cookie when it does not verify or its `sub` differs from the token's. It also accepts the auth API's access token as `Authorization: Bearer`, as it already did when the pair was configured. + - `req.user.roles` (and `request.user.roles`) is the verified token's `roles` claim, or `[]` when the token has none. It no longer falls back to the roles copied into the cookie from the login response. `permissions`, `organizationRoles`, `organizationPermissions` and `organizationId` come from the verified token too. + + What to do when upgrading: pass the same `authServerUrl` and `audience` you give `createSeamlessAuthServer` (or the plugin) to every `requireAuth`, plus `authServerIssuer` if you set one there. The guard fetches the auth API's JWKS once and caches it. + +### Patch Changes + +- Updated dependencies [f24a5a1] +- Updated dependencies [193298a] +- Updated dependencies [c835725] + - @seamless-auth/core@0.27.0 + ## 0.26.0 ### Minor Changes diff --git a/packages/express/package.json b/packages/express/package.json index c2f13ce..a1a5da3 100644 --- a/packages/express/package.json +++ b/packages/express/package.json @@ -1,6 +1,6 @@ { "name": "@seamless-auth/express", - "version": "0.26.0", + "version": "0.27.0", "description": "Express adapter for Seamless Auth passwordless authentication", "keywords": [ "authentication", diff --git a/packages/fastify/CHANGELOG.md b/packages/fastify/CHANGELOG.md index e7aa893..527711c 100644 --- a/packages/fastify/CHANGELOG.md +++ b/packages/fastify/CHANGELOG.md @@ -1,5 +1,38 @@ # @seamless-auth/fastify +## 0.18.0 + +### Minor Changes + +- 193298a: Tighten cross-site request protection when no `allowedOrigins` list is configured, and default the auth cookies to `SameSite=Lax`. + + Behaviour changes: + + - Without `allowedOrigins`, a state-changing request that is `Sec-Fetch-Site: same-site`, or that carries an `Origin` and no `Sec-Fetch-Site` (or `none`), must come from an `Origin` whose host equals the request's `Host`. It used to pass, so a page on a sibling subdomain could send a request that carried the session cookie. A `same-site` request with no `Origin` is now refused. Refusals answer `403 {"error":"cross_site_request_blocked"}`. This applies to the auth routes and to the `requireAuth` and role guards on cookie sessions. + - A `Sec-Fetch-Site` value the Fetch Metadata spec does not define is treated as cross-site and refused. + - `cookieSameSite` now defaults to `lax` whatever `cookieSecure` says. It used to default to `none` when the cookie was secure. + - `checkOrigin` in core takes a new `host` input. Without `allowedOrigins`, a caller that leaves it out has every request with a non-same-origin `Origin` refused. + + 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. + + What to do when upgrading: if your browser app is served from a different host than the adapter, or a proxy in front of the adapter rewrites `Host`, set `allowedOrigins` to the origins your app is served from (or configure the framework to trust the proxy). If your browser app is on a different site from the adapter, set `cookieSameSite: "none"` (with `cookieSecure` left on) to keep the cookie on its requests. +- c835725: Verify the access token inside a session cookie against the auth API's JWKS in the Express and Fastify guards, and take the session's roles, permissions and organization from it alone. + + Behaviour changes: + + - `requireAuth` in `@seamless-auth/express` and `@seamless-auth/fastify` now requires `authServerUrl` and `audience`, and throws when it is constructed without them. The types mark both as required. Before, leaving them out gave a cookie-only guard that trusted the cookie's payload, so anyone holding `cookieSecret` could sign a cookie with any identity, roles or permissions. The Next.js guards already worked this way. + - With the pair set, the guard verifies the cookie's inner access token (issuer, audience, expiry, `typ: "access"`) and refuses the cookie when it does not verify or its `sub` differs from the token's. It also accepts the auth API's access token as `Authorization: Bearer`, as it already did when the pair was configured. + - `req.user.roles` (and `request.user.roles`) is the verified token's `roles` claim, or `[]` when the token has none. It no longer falls back to the roles copied into the cookie from the login response. `permissions`, `organizationRoles`, `organizationPermissions` and `organizationId` come from the verified token too. + + What to do when upgrading: pass the same `authServerUrl` and `audience` you give `createSeamlessAuthServer` (or the plugin) to every `requireAuth`, plus `authServerIssuer` if you set one there. The guard fetches the auth API's JWKS once and caches it. + +### Patch Changes + +- Updated dependencies [f24a5a1] +- Updated dependencies [193298a] +- Updated dependencies [c835725] + - @seamless-auth/core@0.27.0 + ## 0.17.0 ### Minor Changes diff --git a/packages/fastify/package.json b/packages/fastify/package.json index 9f36214..c0cad7f 100644 --- a/packages/fastify/package.json +++ b/packages/fastify/package.json @@ -1,6 +1,6 @@ { "name": "@seamless-auth/fastify", - "version": "0.17.0", + "version": "0.18.0", "description": "Fastify adapter for Seamless Auth passwordless authentication", "keywords": [ "authentication", diff --git a/packages/nextjs/CHANGELOG.md b/packages/nextjs/CHANGELOG.md index 374184a..93073d2 100644 --- a/packages/nextjs/CHANGELOG.md +++ b/packages/nextjs/CHANGELOG.md @@ -1,5 +1,29 @@ # @seamless-auth/nextjs +## 0.11.0 + +### Minor Changes + +- 193298a: Tighten cross-site request protection when no `allowedOrigins` list is configured, and default the auth cookies to `SameSite=Lax`. + + Behaviour changes: + + - Without `allowedOrigins`, a state-changing request that is `Sec-Fetch-Site: same-site`, or that carries an `Origin` and no `Sec-Fetch-Site` (or `none`), must come from an `Origin` whose host equals the request's `Host`. It used to pass, so a page on a sibling subdomain could send a request that carried the session cookie. A `same-site` request with no `Origin` is now refused. Refusals answer `403 {"error":"cross_site_request_blocked"}`. This applies to the auth routes and to the `requireAuth` and role guards on cookie sessions. + - A `Sec-Fetch-Site` value the Fetch Metadata spec does not define is treated as cross-site and refused. + - `cookieSameSite` now defaults to `lax` whatever `cookieSecure` says. It used to default to `none` when the cookie was secure. + - `checkOrigin` in core takes a new `host` input. Without `allowedOrigins`, a caller that leaves it out has every request with a non-same-origin `Origin` refused. + + 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. + + What to do when upgrading: if your browser app is served from a different host than the adapter, or a proxy in front of the adapter rewrites `Host`, set `allowedOrigins` to the origins your app is served from (or configure the framework to trust the proxy). If your browser app is on a different site from the adapter, set `cookieSameSite: "none"` (with `cookieSecure` left on) to keep the cookie on its requests. + +### Patch Changes + +- Updated dependencies [f24a5a1] +- Updated dependencies [193298a] +- Updated dependencies [c835725] + - @seamless-auth/core@0.27.0 + ## 0.10.0 ### Minor Changes diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 340bbc6..7454113 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@seamless-auth/nextjs", - "version": "0.10.0", + "version": "0.11.0", "description": "Next.js App Router adapter for Seamless Auth passwordless authentication", "keywords": [ "authentication",