diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e3a75e..9a1941d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -180,3 +180,49 @@ jobs: run: | node --test tests/isolated-http-access.test.js SESSION_HTTP_MODE=refresh node --test tests/isolated-http-access.test.js + + strapi-floor: + name: Real Strapi HTTP suites on the peer floor (Strapi 5.50.0) + runs-on: ubuntu-latest + timeout-minutes: 25 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '22' + cache: npm + + - name: Install dependencies + run: npm ci --legacy-peer-deps + + # package.json peers: @strapi/strapi and @strapi/plugin-users-permissions ^5.50.0. + # 5.50.0 added sessionManager listSessions/revokeSessionById and admin session + # metadata; the suites below fail on 5.49.0 and older. + - name: Install the Strapi 5.50.0 floor host + run: | + mkdir -p "$RUNNER_TEMP/strapi-floor" + cd "$RUNNER_TEMP/strapi-floor" + echo '{"name":"strapi-floor-host","version":"0.0.0","private":true}' > package.json + npm install --no-audit --no-fund --legacy-peer-deps @strapi/strapi@5.50.0 @strapi/plugin-users-permissions@5.50.0 better-sqlite3@13 jsonwebtoken + for pkg in strapi core admin plugin-users-permissions; do + version=$(node -p "require('./node_modules/@strapi/$pkg/package.json').version") + echo "@strapi/$pkg $version" + test "$version" = 5.50.0 + done + + - name: HTTP suites on Strapi 5.50.0 + env: + SESSION_HTTP_REQUIRED: '1' + SESSION_HTTP_STRAPI_NODE_MODULES: ${{ runner.temp }}/strapi-floor/node_modules + run: | + node --test tests/isolated-http-access.test.js + SESSION_HTTP_MODE=refresh node --test tests/isolated-http-access.test.js + SESSION_HTTP_FALLBACK=1 node --test tests/isolated-http-access.test.js + node --test tests/isolated-admin-sessions-http.test.js + node --test tests/isolated-native-capture-http.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c6b6ce..a09da45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +## [Unreleased] + +Release type: patch (`fix`). This corrects an untested compatibility claim; it is not a breaking change, because the plugin never worked fully on the Strapi versions now excluded. + +### Fixed + +* **Strapi peer floor corrected from `^5.0.0` to `^5.50.0`** (`@strapi/strapi` and `@strapi/plugin-users-permissions`). The old range was never tested. Strapi 5.50.0 added the session-manager methods the plugin calls (`listSessions`, `revokeSessionById`) and the `metadata` column of `admin::session` ([strapi/strapi#26628](https://github.com/strapi/strapi/pull/26628)). Measured with the real-HTTP suites on isolated hosts: on 5.24.0, 5.30.0, 5.40.0, 5.45.0 and 5.49.0, sign-in with `jwtManagement: 'refresh'` fails closed with 503, session list and revoke routes fail, and the Admin panel sessions routes return 500 in both JWT modes; 5.0.4 and 5.23.6 have no session manager or `admin::session` at all; 5.0.0 to 5.0.3 declare Node.js 20 or older, outside this plugin's `engines`. On 5.50.0 and 5.62.0 every suite passes. +* The plugin logs one clear error at start-up on Strapi older than 5.50.0 (`Strapi 5.x.y is not supported: Magic Session Manager requires Strapi 5.50.0 or later …`) instead of failing later on single requests. +* README badge, Compatibility table and project site now say Strapi 5.50+. + +### Upgrade note + +* Strapi 5.50.0 or later: nothing to do. +* Strapi older than 5.50.0: upgrade Strapi first (`npx @strapi/upgrade minor`), rebuild the admin and restart. npm 7+ refuses to install this release next to an older Strapi because of the peer range; until you upgrade Strapi, stay on your current plugin version. + +### Tests + +* New CI job `strapi-floor` installs Strapi 5.50.0 and Users & Permissions 5.50.0 into a separate directory and runs the HTTP access suite (legacy, refresh, fallback logout), the admin panel sessions suite and the native session capture suite against it. +* `tests/strapi-version-floor.test.js` checks the floor constant, the start-up error, that the peers and the CI job name the same floor. +* The native capture suite's provider-callback case now also sends the provider token in the query string, which Strapi 5.50 reads (5.62 reads the grant session), so it runs on both versions. + # [4.14.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.1...v4.14.0) (2026-11-18) diff --git a/README.md b/README.md index 530762a..d32f4d7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Free and open source under the MIT license. Every feature works without an accou [](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager) [](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml?query=branch%3Amain) [](https://github.com/Schero94/Magic-Sessionmanager/blob/main/LICENSE) -[](https://github.com/Schero94/Magic-Sessionmanager#compatibility) +[](https://github.com/Schero94/Magic-Sessionmanager#compatibility) [](https://schero94.github.io/Magic-Sessionmanager/) Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.github.io/Magic-Sessionmanager/) · [npm](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager) · [Changelog](https://github.com/Schero94/Magic-Sessionmanager/blob/main/CHANGELOG.md) · [Report a bug](https://github.com/Schero94/Magic-Sessionmanager/issues/new/choose) · [Discussions](https://github.com/Schero94/Magic-Sessionmanager/discussions) @@ -224,7 +224,7 @@ Shown on the edit view of a Users & Permissions user only. ### Online users widget -Strapi 5.13 and later. Four tiles: **Online users** (of all registered users), **Active sessions**, **Idle sessions** and **Blocked users**, plus a link **Open Session Manager**. The widget refreshes every 30 seconds. +Part of every supported Strapi version (the widgets API exists since Strapi 5.13). Four tiles: **Online users** (of all registered users), **Active sessions**, **Idle sessions** and **Blocked users**, plus a link **Open Session Manager**. The widget refreshes every 30 seconds. ### Settings › Session Manager @@ -248,17 +248,17 @@ Two links: **Configuration** and **Analytics**. ## Compatibility -| Item | Supported | -| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Strapi | 5 (`@strapi/strapi` peer range `^5.0.0`). Acceptance host: Strapi 5.62.0. | -| Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) | -| Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` | -| Homepage widget | Strapi 5.13 and later (older versions have no widgets API; the rest works) | -| Admin panel sessions | Strapi 5 with Strapi's session manager (`strapi.sessionManager`, admin origin); tested with 5.62.0. Without it the view says it is not available and the sign-out routes return 503. | -| Required peers | `@strapi/strapi` `^5.0.0`, `@strapi/plugin-users-permissions` `^5.0.0`, `react` / `react-dom` `^18.0.0`, `react-router-dom` `^6.0.0`, `styled-components` `^6.0.0`. A new Strapi 5 app already has all of them. | -| Optional peers | `@strapi/design-system` `^2.0.0`, `@strapi/icons` `^2.0.0`, `react-intl` `^6.0.0`. Strapi's admin brings them; they are marked optional so npm, Yarn and pnpm do not warn. | -| Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. | -| Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). | +| Item | Supported | +| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Strapi | 5.50.0 and later 5.x (`@strapi/strapi` peer range `^5.50.0`). Tested in CI on 5.50.0 (floor) and 5.62.0 (acceptance host). Strapi 5.0 to 5.49 are not supported, see [Upgrading › Strapi older than 5.50](#strapi-older-than-550). | +| Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) | +| Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` | +| Homepage widget | Included (Strapi's widgets API exists since 5.13). | +| Admin panel sessions | Uses Strapi's session manager (`strapi.sessionManager('admin')`) and the device label in `admin::session` metadata, both available from Strapi 5.50.0; tested on 5.50.0 and 5.62.0. | +| Required peers | `@strapi/strapi` `^5.50.0`, `@strapi/plugin-users-permissions` `^5.50.0`, `react` / `react-dom` `^18.0.0`, `react-router-dom` `^6.0.0`, `styled-components` `^6.0.0`. A new Strapi 5 app already has all of them. | +| Optional peers | `@strapi/design-system` `^2.0.0`, `@strapi/icons` `^2.0.0`, `react-intl` `^6.0.0`. Strapi's admin brings them; they are marked optional so npm, Yarn and pnpm do not warn. | +| Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. | +| Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). | --- @@ -920,6 +920,18 @@ Session history lives in the content-type tables `magic_sessions` and `magic_ses ## Migration and upgrading +### Strapi older than 5.50 + +Earlier releases said "Strapi 5.0+" (`^5.0.0`) without testing older versions. The real floor is **Strapi 5.50.0**: the plugin calls `listSessions` and `revokeSessionById` on Strapi's session manager and reads the device label in `admin::session` metadata, which Strapi added in 5.50.0 ([strapi/strapi#26628](https://github.com/strapi/strapi/pull/26628)). Measured with this repository's real-HTTP suites: + +| Strapi | Result | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 5.0.0 to 5.23.x | No session manager and no `admin::session` table (added in 5.24.0). 5.0.0 to 5.0.3 also declare Node.js 20 or older, outside this plugin's `engines`. | +| 5.24.0 to 5.49.x | With `jwtManagement: 'refresh'`, sign-in fails closed with 503 and session routes fail; the Admin panel view returns 500 in both modes. | +| 5.50.0, 5.62.0 | All suites pass (both JWT modes, the fallback logout, admin panel sessions, native session capture); the packed plugin installs without peer warnings and the admin panel builds on 5.50.0. | + +On Strapi below 5.50.0 the plugin logs one error at start-up (`Strapi 5.x.y is not supported: Magic Session Manager requires Strapi 5.50.0 or later …`). Upgrade Strapi to 5.50.0 or later ([Strapi upgrade tool](https://docs.strapi.io/cms/upgrade-tool)), rebuild the admin and restart. If you cannot upgrade Strapi yet, stay on your current plugin version; it never worked fully on those versions either. + ### To the next release (license removal, from 4.10.x) Nothing to do for most apps. @@ -963,6 +975,8 @@ SESSION_HTTP_REQUIRED=1 SESSION_HTTP_STRAPI_NODE_MODULES=$PWD/node_modules node # PostgreSQL: add SESSION_HTTP_DB=postgres MSM_TEST_PG_URL=postgres://user:pass@127.0.0.1:5432/db ``` +CI runs the same suites a second time against Strapi 5.50.0, the peer floor, installed into a separate directory (`SESSION_HTTP_STRAPI_NODE_MODULES=
@strapi/strapi ^5.0.0); acceptance host Strapi 5.62.0@strapi/strapi ^5.50.0); tested on 5.50.0 and
+ 5.62.0 (acceptance host)
+