strapi-plugin-magic-sessionmanager 4.9.1 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +86 -5
  2. package/README.md +427 -91
  3. package/dist/admin/{Analytics-lVDnHBYp.js → Analytics-CBHeWeGn.js} +1 -1
  4. package/dist/admin/{Analytics-dyJmyxO-.mjs → Analytics-D56O8Q6e.mjs} +1 -1
  5. package/dist/admin/{App-CdgiY_Y7.js → App-D4cBPwB_.js} +2 -3
  6. package/dist/admin/{App-Cgf_CSjw.mjs → App-EDIkLJdb.mjs} +2 -3
  7. package/dist/admin/{OnlineUsersWidget-DMPtuIpm.js → OnlineUsersWidget-BF2R2YIy.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-DJC4V1KS.mjs → OnlineUsersWidget-MwUutkKQ.mjs} +1 -1
  9. package/dist/admin/{Settings-0QsyY7fe.js → Settings-CMzEF8EH.js} +21 -5
  10. package/dist/admin/{Settings-DgeuUiMF.mjs → Settings-bLMyi0BN.mjs} +20 -4
  11. package/dist/admin/{de-j0oZH9Pz.mjs → de-CxfuTF6C.mjs} +1 -42
  12. package/dist/admin/{de-BFKoGEVT.js → de-DVNTHmSo.js} +1 -42
  13. package/dist/admin/{en-UY4Tb5tE.mjs → en-BcPIlQYL.mjs} +1 -42
  14. package/dist/admin/{en-s7Ksdkcg.js → en-BuVXIcHA.js} +1 -42
  15. package/dist/admin/{es-07OGMe_5.js → es-CEteHmBO.js} +1 -42
  16. package/dist/admin/{es-DGBcZwQy.mjs → es-DxHpaNA1.mjs} +1 -42
  17. package/dist/admin/{fr-ETj_2UBY.js → fr-BMd2-wW7.js} +1 -42
  18. package/dist/admin/{fr-B6-DWhGO.mjs → fr-Dw43lHg7.mjs} +1 -42
  19. package/dist/admin/{index-D-Nr0TCm.js → index-DvNfekoR.js} +9 -19
  20. package/dist/admin/{index-Ck19e8qw.mjs → index-qa6Qnfkc.mjs} +9 -19
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +1 -1
  23. package/dist/admin/{pt-YMRLm9gx.mjs → pt-7jnxDSX-.mjs} +1 -42
  24. package/dist/admin/{pt-C7PwrQtV.js → pt-BvO63p01.js} +1 -42
  25. package/dist/server/index.js +1322 -827
  26. package/dist/server/index.mjs +1322 -827
  27. package/package.json +32 -13
  28. package/dist/admin/License-1XUfQty5.js +0 -443
  29. package/dist/admin/License-C4WSYoqY.mjs +0 -443
  30. package/dist/admin/maskSensitiveValue-BWcSjow7.js +0 -9
  31. package/dist/admin/maskSensitiveValue-lLRhN_S7.mjs +0 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,86 @@
1
+ # [4.11.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.10.0...v4.11.0) (2026-11-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * remove the license feature and every license server call ([#8](https://github.com/Schero94/Magic-Sessionmanager/issues/8)) ([c5ba2ef](https://github.com/Schero94/Magic-Sessionmanager/commit/c5ba2ef6b3e32f11cfadaed479a6d2e5688b3415))
7
+
8
+ ## [Unreleased]
9
+
10
+ Release type: minor. `feat:` removes the license feature; `fix:` corrects the package metadata. No `BREAKING CHANGE` footer, see "Version decision" below.
11
+
12
+ ### Removed
13
+
14
+ * **The License page and the license feature.** Settings › Session Manager now has two links, **Configuration** and **Analytics**. The License page, its settings link, the pass-through `LicenseGuard` wrapper and the 42 `license.*` messages in each of the five admin languages are gone.
15
+ * **All calls to the license server** (`magicapi.fitlex.me`). The plugin makes no install, license or telemetry request of any kind. The only outbound requests are the ones you turn on: ipapi.co lookups, Discord or Slack webhooks, emails through your Email provider and the MaxMind database download.
16
+ * **Admin routes** `GET /magic-sessionmanager/license/status` and `POST /magic-sessionmanager/license/auto-create`, `/license/create`, `/license/ping`, `/license/store-key`, with their controller and the `license-guard` service.
17
+ * **Environment variables** `MAGIC_LICENSE_SERVER_URL` and `MAGIC_LICENSE_TIMEOUT_MS` (no longer read).
18
+
19
+ ### Changed
20
+
21
+ * **Stored license data is deleted at startup.** The plugin store keys `licenseKey`, `lastValidated` and `deviceId` (a hash of the server's MAC addresses and host name) are removed with one `deleteMany` statement. It is idempotent and safe when several instances start at once; a failure is logged by error name and retried on the next start. MaxMind GeoIP credentials and all settings are kept.
22
+ * **No install warnings from the plugin.** `@strapi/utils` (used by the server code) moved from `peerDependencies` to `dependencies`. `@strapi/design-system`, `@strapi/icons` and `react-intl`, which a Strapi app gets through `@strapi/strapi`, are optional peers (`peerDependenciesMeta`). `@strapi/plugin-users-permissions ^5.0.0` is now a declared peer, because sessions relate to its user type. `react` and `react-dom` peers are `^18.0.0`, as in the Strapi 5 app template.
23
+ * **Package metadata:** plain description, `homepage` is the project site (https://schero94.github.io/Magic-Sessionmanager/), `repository.url` uses the `git+https` form that `npm pkg fix` expects, and the keywords describe what the plugin does.
24
+ * **README and project site** rewritten: features, a one-minute quick start, examples, performance notes, FAQ and migration notes.
25
+
26
+ ### Fixed
27
+
28
+ * A unit test for revocation expiry read the clock twice and failed when a second boundary passed in between.
29
+ * The first start on a new database no longer logs the warning "Authenticated role not found - skipping permission setup". Users & Permissions can create its roles after the plugin's bootstrap, and the plugin already finished the setup before the first Session Manager API request. The message is now an info line that says so.
30
+
31
+ ### Version decision
32
+
33
+ Minor, not major. The removed routes were admin routes (admin JWT plus `plugin::magic-sessionmanager.access`) that only the plugin's own License page called, and that page ships in the same package and is removed with them. No feature was ever gated by a key, and the Content API, permissions, settings and session data are unchanged. Anyone who scripted the license routes with an admin token gets 404 or 405 now; see Migration.
34
+
35
+ ### Migration
36
+
37
+ 1. Nothing to do for most apps. Rebuild the admin (`npm run build`) after upgrading, as for every release.
38
+ 2. Remove scripts that call `/magic-sessionmanager/license/*`, and the variables `MAGIC_LICENSE_SERVER_URL` and `MAGIC_LICENSE_TIMEOUT_MS` if you set them.
39
+ 3. Bookmarks to `/admin/settings/magic-sessionmanager/license` open an empty settings page, as any unknown settings route does in Strapi 5.61; use Configuration or Analytics.
40
+
41
+ # [4.10.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.9.1...v4.10.0) (2026-11-07)
42
+
43
+
44
+ ### Bug Fixes
45
+
46
+ * **server:** hold the lockout and rate limits exactly under parallel bursts ([7fd9a1a](https://github.com/Schero94/Magic-Sessionmanager/commit/7fd9a1aed8d3959027a46791ad6603489812f6eb))
47
+ * **server:** let a shortened job interval take over an over-long lease ([618f564](https://github.com/Schero94/Magic-Sessionmanager/commit/618f5643ba83ea6a4ee175d65068dad089626d64))
48
+
49
+
50
+ ### Features
51
+
52
+ * **admin:** send the settings revision and explain a concurrent save ([ef4e08a](https://github.com/Schero94/Magic-Sessionmanager/commit/ef4e08a19ac853e37c0affda27c54d1024879ab1))
53
+ * **server:** keep lockout, rate limits, jobs and settings consistent across instances ([976fa67](https://github.com/Schero94/Magic-Sessionmanager/commit/976fa67e5299fcb3d02f1852645fecd85bb4419c))
54
+
55
+ ### Release notes: multi-instance deployments (pm2 cluster, Railway replicas)
56
+
57
+ These notes were written as `[Unreleased]` on the branch and shipped in 4.10.0 (minor: `feat` commits, no breaking change; API clients that send no settings `revision` behave as before).
58
+
59
+ Every hazard from the multi-instance audit (SM-MI-01 to SM-MI-14) is addressed for several Node processes sharing one database:
60
+
61
+ * **Failed-login lockout and Content API rate limits are cluster-wide.** Counters live in the new `magic_sm_counters` table (IP and caller keys stored as SHA-256 hashes) and are updated atomically. Before, each process counted on its own, so 8 processes allowed about 8x the configured attempts.
62
+ * **Fix: the failed-login lockout never counted wrong passwords** in Strapi 5, because Users & Permissions throws a `ValidationError` and the counting code after `await next()` did not run. Thrown errors are now classified like Strapi's errors middleware does and re-thrown unchanged.
63
+ * **Cleanup and retention run on one process per interval** via a job lease (`magic_sm_leases`). Retention now runs about 5 minutes after a start and then daily; before, the first run came 24 hours after a start, so frequent deploys could postpone it indefinitely.
64
+ * **Permission setup, session-index creation and all plugin-store writes run in a cluster-wide critical section** (`pg_advisory_xact_lock` on PostgreSQL, lease row elsewhere). Duplicate Core Store rows and duplicate Authenticated-role permissions from parallel first boots are removed automatically.
65
+ * **Conditional session updates.** Idle cleanup, the JWT check (idle, expired, legacy reactivation) and `lastActive` updates use compare-and-set `updateMany` calls, so a stale read can no longer revive a terminated session or overwrite a `manual` / `blocked` reason.
66
+ * **Settings reach every process within about 2 seconds** through a shared revision. `GET /settings` and `PUT /settings` return `revision`; a `PUT` that sends a stale `revision` gets 409 (the admin shows a new message in five languages). Clients that send no revision behave as before.
67
+ * **Shared ipapi.co cache and 429 back-off**, so 8 processes no longer use 8x the quota.
68
+ * **Toggle-mode user blocking** is serialised per user; the admin already uses the explicit mode.
69
+ * **Encryption key check:** instances with different `SESSION_ENCRYPTION_KEY` values log an error at startup (only an HMAC check value is compared).
70
+ * GeoIP status reports `scope: "instance"` and a host fingerprint, because the MMDB file is local to each instance.
71
+ * New README section "Running several instances (Railway replicas, pm2 cluster)" with exact configuration, a pm2 ecosystem file, an optional Redis counter store and the Strapi core first-boot caveat.
72
+ * New `npm run test:concurrency` (8 processes on SQLite and PostgreSQL) and a CI job with a PostgreSQL 16 service.
73
+ * **Fix (found by the 4-process HTTP proof): a parallel burst bypassed the lockout.** The attempt was counted only after the password check, so every request of a burst passed the "is this IP locked?" check first (10 of 48 parallel wrong passwords reached the check with `maxFailedLogins: 5`, limited only by Strapi's own per-process limiter). The attempt is now reserved before the check: at most `maxFailedLogins` failed or still-running attempts per IP reach the password check, cluster-wide. Behaviour change: when more than `maxFailedLogins` login requests from one IP are in flight at the same moment, the extra ones get HTTP 429 with `Retry-After: 1` and the message "Too many login attempts at once. Please try again." They do not lock the IP; only completed failures do. A login that ends with a 5xx gives its reserved attempt back.
74
+ * **Fix: shared counters reported a count that included later concurrent hits,** so under a burst the Content API rate limit let fewer requests through than configured (2 of 48 parallel `logout-others` calls with a limit of 10). Counters now return the value written by the request itself (`UPDATE ... RETURNING` on PostgreSQL and SQLite, UPDATE + `SELECT ... FOR UPDATE` in one transaction on MySQL). The same applies to settings revisions.
75
+ * **Fix: a shortened cleanup interval could wait for the old job lease.** The idle-cleanup lease lasts one interval; a lease taken under the 30-minute default (for example by the process that ran before a restart) kept blocking the cleanup for up to 30 minutes after the interval was set to 5. A lease that ends more than 60 seconds later than a fresh one would may now be taken over. After a restart without a settings change the job keeps its schedule, so the first run on the new process can come up to one interval after the last run on the old one.
76
+ * **Fix: parallel "log out other devices" calls could answer 500.** Two requests (on one or several instances) revoked the same native session; the one that lost the race treated "already revoked" as a failure. A native revoke that is not confirmed now succeeds when the session is no longer active, and still fails when it is.
77
+
78
+ ### Migration to 4.10.0
79
+
80
+ * On start the plugin creates three tables: `magic_sm_counters`, `magic_sm_leases`, `magic_sm_cache`. The database user needs the `CREATE` privilege once. Strapi's schema sync does not touch these tables.
81
+ * New optional config `coordination: { enabled, counterStore }`. `enabled: false` restores per-process state.
82
+ * Lockout counters start empty after the upgrade.
83
+
1
84
  ## [4.9.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.9.0...v4.9.1) (2026-11-07)
2
85
 
3
86
 
@@ -27,13 +110,11 @@
27
110
  * **admin:** apply session information architecture to every screen ([9a4c30d](https://github.com/Schero94/Magic-Sessionmanager/commit/9a4c30dd2af47e4559d5c3521f7ee9d6938e39a9))
28
111
  * **admin:** rebuild UI on shared Design System blocks and fix review findings ([187dbac](https://github.com/Schero94/Magic-Sessionmanager/commit/187dbacac505abc747e1f761d913f8dc74874bc6))
29
112
 
30
- ## [Unreleased]
31
-
32
- Branch `claude/sessionmanager-ui-redesign`. Not yet accepted: see `GATES.md` and `gates/ui-redesign.md`. Whoever cuts the next release must fold this section into the generated release entry, so it does not stay behind as a second `[Unreleased]` block.
113
+ The following notes for 4.9.0 were moved here on 2026-11-07 from a stale `[Unreleased]` block (branch `claude/sessionmanager-ui-redesign`, released as 4.9.0).
33
114
 
34
115
  ### Known issues in 4.8.0
35
116
 
36
- 4.8.0 was released before its acceptance gates closed, although its release-readiness audit said not to publish. It is not accepted. Known defects in 4.8.0, fixed on this branch:
117
+ 4.8.0 was released before its acceptance gates closed, although its release-readiness audit said not to publish. It is not accepted. Known defects in 4.8.0, fixed in 4.9.0:
37
118
 
38
119
  * The Session Details dialog has no accessible name, and focus can land on the page body after Escape.
39
120
  * Settings field hints, including the GeoIP privacy disclosure, never render.
@@ -211,7 +292,7 @@ The native Strapi Users & Permissions end-user session support from 2f00880 cove
211
292
 
212
293
  ### Bug Fixes
213
294
 
214
- * **deps:** bump devDependencies (sdk-plugin v6, design-system 2.2, styled-components 6.4) ([bf9a743](https://github.com/Schero94/Magic-Sessionmanager/commit/bf9a7433995dc96c23f8f4a149081fe858b7332f)), closes [package.json#exports](https://github.com/package.json/issues/exports)
295
+ * **deps:** bump devDependencies (sdk-plugin v6, design-system 2.2, styled-components 6.4) ([bf9a743](https://github.com/Schero94/Magic-Sessionmanager/commit/bf9a7433995dc96c23f8f4a149081fe858b7332f))
215
296
 
216
297
  ## [4.5.6](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.5.5...v4.5.6) (2026-04-20)
217
298