strapi-plugin-magic-sessionmanager 4.13.0 → 4.14.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 (42) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +109 -76
  3. package/dist/admin/{Analytics-BikQQx_J.js → Analytics-DSG3shUY.js} +1 -1
  4. package/dist/admin/{Analytics-DIY51RI_.mjs → Analytics-oW2QbDj4.mjs} +1 -1
  5. package/dist/admin/{App-B3vaybSO.mjs → App-BRj2qIUs.mjs} +1036 -11
  6. package/dist/admin/{App-BV1LM9Bp.js → App-DcxqQfMT.js} +1034 -9
  7. package/dist/admin/{OnlineUsersWidget-fJogM1xl.js → OnlineUsersWidget-CCTnV-aE.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-T-2upsDd.mjs → OnlineUsersWidget-wxDYyK5v.mjs} +1 -1
  9. package/dist/admin/{Settings-BpBlXyMY.mjs → Settings-BNPO9cXS.mjs} +1 -1
  10. package/dist/admin/{Settings-AyYka8wn.js → Settings-XdBlPves.js} +1 -1
  11. package/dist/admin/{de-z0aHRwdw.js → de-B0CBR1Dw.js} +89 -1
  12. package/dist/admin/{de-BSCDuq1i.mjs → de-BlKn1pSD.mjs} +89 -1
  13. package/dist/admin/{en-BWPOiiMt.js → en-D0ZGIIjz.js} +89 -1
  14. package/dist/admin/{en-B4Cuq9JN.mjs → en-IT0YTY8f.mjs} +89 -1
  15. package/dist/admin/{es-DBAmysKi.mjs → es-BCGzaaCh.mjs} +89 -1
  16. package/dist/admin/{es-CMskkUh-.js → es-CWee-XCR.js} +89 -1
  17. package/dist/admin/{fr-ClJ2BkrE.js → fr-rQS1M7jE.js} +89 -1
  18. package/dist/admin/{fr-BNGdtjEl.mjs → fr-xBIH4Byq.mjs} +89 -1
  19. package/dist/admin/{index-DyE1rLW0.js → index-BBZNey0n.js} +15 -10
  20. package/dist/admin/{index-mCVi1j7e.mjs → index-BcQdNWzu.mjs} +33 -28
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +2 -2
  23. package/dist/admin/{pt-CRh_J7JS.js → pt-C-yTLhnS.js} +89 -1
  24. package/dist/admin/{pt-Cl7TWsOV.mjs → pt-DWDeIDVa.mjs} +89 -1
  25. package/dist/server/index.js +666 -1
  26. package/dist/server/index.mjs +666 -1
  27. package/package.json +6 -6
  28. package/pics/analytics.png +0 -0
  29. package/pics/dashboard-dark.png +0 -0
  30. package/pics/dashboard.png +0 -0
  31. package/pics/dashboardsessionmodal.png +0 -0
  32. package/pics/mobile-dashboard.png +0 -0
  33. package/pics/mobile-session.png +0 -0
  34. package/pics/sessioninfopanel.png +0 -0
  35. package/pics/settings1.png +0 -0
  36. package/pics/settings2.png +0 -0
  37. package/pics/untracked-confirm-dialog.webp +0 -0
  38. package/pics/untracked-disclosure-warning-dark.webp +0 -0
  39. package/pics/untracked-disclosure-warning.webp +0 -0
  40. package/pics/untracked-mobile-notice-warning.webp +0 -0
  41. package/pics/untracked-notice-neutral.webp +0 -0
  42. package/pics/widget.png +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,51 @@
1
+ # [4.14.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.1...v4.14.0) (2026-11-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * see and sign out Strapi admin panel sessions ([#22](https://github.com/Schero94/Magic-Sessionmanager/issues/22)) ([a088b03](https://github.com/Schero94/Magic-Sessionmanager/commit/a088b039968c6679676e0df9cb0d34fc440b047b))
7
+
8
+
9
+ Release type: minor (`feat`), no breaking change. Existing routes, responses, numbers, widgets, settings and Content API features are unchanged. No migration needed.
10
+
11
+ ### Added
12
+
13
+ * **Admin panel sessions.** A new **Admin panel** view on the Session Manager page (`/admin/plugins/magic-sessionmanager/admin-panel`), next to the app-user dashboard, shows who can use the Strapi admin panel and who is signed in: every admin with roles, status (Signed in, Not signed in, Deactivated, Invited), last activity and the signed-in browsers (Strapi's device label, signed in, last active, latest end, "This browser", "Remember me"). Search, a sign-in status filter and pagination run on the server. All five languages.
14
+ * **Sign admins out.** **Sign out** (one browser) and **Sign out everywhere**, each confirmed. Strapi 5.62 checks the admin session on every admin request, so the admin is signed out on their next click and lands on the login page; there is no waiting for the access token to expire. The plugin deletes every Strapi session record of the browser, so older access tokens of rotated records stop working too. Signing yourself out of the current browser shows a warning. **Manage in Settings** links to Strapi's Settings › Users to deactivate an account.
15
+ * Admin routes `GET /magic-sessionmanager/admin-sessions/admins`, `GET /magic-sessionmanager/admin-sessions/admins/:adminId/sessions`, `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` and `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sign-out-everywhere` (contracts in the README).
16
+ * RBAC actions `plugin::magic-sessionmanager.admin-sessions.read` ("Read admin panel sessions") and `plugin::magic-sessionmanager.admin-sessions.revoke` ("Sign out admins"), granted to Super Admin only by default.
17
+
18
+ ### Security
19
+
20
+ * Sign-outs need a signed-in administrator (admin API tokens get 403), are limited to 10 per minute per admin, and write one info log line with admin ids and counts only (`[magic-sessionmanager] Admin sign-out: actor=… target=… scope=one|all ended=…`), plus the Strapi event `magic-sessionmanager.admin-sessions.signed-out`.
21
+ * An admin without the Super Admin role cannot sign out a Super Admin (403 `super-admin-protected`), so the last active Super Admin can never be signed out by someone else.
22
+ * A session id that is not a live session of the given admin answers 404, like an unknown id. Responses never contain tokens, device ids or password fields. The plugin stores nothing about admins; Strapi records no IP address for admin sessions.
23
+
24
+ ### Changed
25
+
26
+ * Admin session rows (`origin = 'admin'`) stay out of every app-user number; regression tests now cover the dashboard statistics, the untracked-session count and the widget totals with admin sessions present.
27
+
28
+ ### Tests
29
+
30
+ * Real-HTTP suite `tests/isolated-admin-sessions-http.test.js` on SQLite and PostgreSQL: admins sign in through `POST /admin/login`; listing, sign-out of one browser and everywhere, self sign-out, Super Admin guard, RBAC denials, rate limit, rejected next request and refresh. New CI job runs it, plus the existing HTTP access suite in both JWT modes, against the Strapi 5.62 devDependencies (`@strapi/plugin-users-permissions` is now a devDependency).
31
+
32
+ ## [4.13.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.0...v4.13.1) (2026-11-17)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **readme:** make images and links work on the Strapi marketplace ([#18](https://github.com/Schero94/Magic-Sessionmanager/issues/18)) ([825507a](https://github.com/Schero94/Magic-Sessionmanager/commit/825507a74d3a87761495462561339895414d00be))
38
+
39
+
40
+ ### Fixed
41
+
42
+ * README screenshots and links now work on the Strapi marketplace and on npm. Both render the packaged README relative to their own pages, so the relative `pics/...`, `LICENSE` and `CHANGELOG.md` references in 4.13.0 returned 404. Images now load from the project site and links point to GitHub. The README shows eight key screenshots and links the full gallery on the project site. A test fails on any relative image or link URL.
43
+ * The README dependency-advisory note now names the current Strapi core advisory (picomatch GHSA-fc5q-39xc-vjpf through `@strapi/utils`) instead of claiming 0 findings.
44
+
45
+ ### Changed
46
+
47
+ * The npm package no longer ships the `pics/` folder (about 0.5 MB smaller); the README loads its images from the project site.
48
+
1
49
  # [4.13.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.12.0...v4.13.0) (2026-11-12)
2
50
 
3
51
 
@@ -5,7 +53,7 @@
5
53
 
6
54
  * explain and diagnose untracked Strapi sessions, link sign-ins outside intercepted routes ([#15](https://github.com/Schero94/Magic-Sessionmanager/issues/15)) ([0a8d584](https://github.com/Schero94/Magic-Sessionmanager/commit/0a8d584c1c802c61b412f581c8317a64a77fb336))
7
55
 
8
- ## [Unreleased]
56
+ ## 4.13.0 details (written before the release)
9
57
 
10
58
  Release type: minor (`feat` and `fix`), no breaking change. No migration needed; existing routes and responses are unchanged, `GET /sessions/stats` gains one field.
11
59
 
package/README.md CHANGED
@@ -6,18 +6,20 @@
6
6
 
7
7
  **See who is signed in to your Strapi 5 app, end any session in one click, and stop password guessing before it reaches your users.**
8
8
 
9
- Magic Session Manager records every sign-in through Users & Permissions as a session. Admins see who is online, end single sessions or all sessions of a user, block accounts and review sign-in history. Your app gets logout routes, a "my devices" list for users, failed-login lockout and optional country rules. It works with Strapi's native refresh-token sessions and with several server processes on one database.
9
+ Magic Session Manager records every sign-in through Users & Permissions as a session. Admins see who is online, end single sessions or all sessions of a user, block accounts and review sign-in history. Your app gets logout routes, a "my devices" list for users, failed-login lockout and optional country rules. It works with Strapi's native refresh-token sessions and with several server processes on one database. A separate **Admin panel** view shows who is signed in to the Strapi admin panel itself and signs an admin out of one browser or everywhere.
10
10
 
11
11
  Free and open source under the MIT license. Every feature works without an account, key or activation, and the plugin sends nothing to its author.
12
12
 
13
13
  [![npm version](https://img.shields.io/npm/v/strapi-plugin-magic-sessionmanager.svg)](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager)
14
14
  [![npm downloads](https://img.shields.io/npm/dm/strapi-plugin-magic-sessionmanager.svg)](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager)
15
- [![Tests](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml/badge.svg)](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml)
16
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
15
+ [![CI build status](https://img.shields.io/github/actions/workflow/status/Schero94/Magic-Sessionmanager/test.yml?branch=main&label=CI&logo=github)](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml?query=branch%3Amain)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Schero94/Magic-Sessionmanager/blob/main/LICENSE)
17
+ [![Strapi 5.0+](https://img.shields.io/badge/Strapi-5.0%2B-4945FF.svg)](https://github.com/Schero94/Magic-Sessionmanager#compatibility)
18
+ [![Documentation site](https://img.shields.io/badge/docs-project%20site-6d4aff.svg)](https://schero94.github.io/Magic-Sessionmanager/)
17
19
 
18
- 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](CHANGELOG.md) · [Report a bug](https://github.com/Schero94/Magic-Sessionmanager/issues/new/choose) · [Discussions](https://github.com/Schero94/Magic-Sessionmanager/discussions)
20
+ 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)
19
21
 
20
- ![Sessions dashboard with four stat cards (Active, Idle, Ended, All), search, status filter and a table of sessions with state badges](pics/dashboard.png)
22
+ ![Sessions dashboard with four stat cards (Active, Idle, Ended, All), search, status filter and a table of sessions with state badges](https://schero94.github.io/Magic-Sessionmanager/img/dashboard.webp)
21
23
 
22
24
  ---
23
25
 
@@ -64,6 +66,7 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
64
66
  | Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
65
67
  | Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
66
68
  | Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
69
+ | Admin panel sessions | Who can use the Strapi admin panel, who is signed in, on which browser and since when. Sign an admin out of one browser or everywhere; it takes effect on their next click. |
67
70
  | Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
68
71
  | Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
69
72
  | Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
@@ -97,48 +100,37 @@ Yarn and pnpm work the same way (`yarn add strapi-plugin-magic-sessionmanager`,
97
100
 
98
101
  ## Screenshots
99
102
 
100
- All screenshots use synthetic data: users `*.example.test`, IP addresses from the documentation range `203.0.113.0/24`, Strapi 5.61.
101
-
102
- ### Sessions dashboard in dark mode
103
-
104
- ![Sessions dashboard in the Strapi dark theme](pics/dashboard-dark.png)
103
+ All screenshots use synthetic data: users `*.example.test`, IP addresses from the documentation range `203.0.113.0/24`, Strapi 5.61. The [full gallery](https://schero94.github.io/Magic-Sessionmanager/#screenshots) on the project site also shows Analytics, dark mode, every settings tab, the untracked sign-in dialogs and more mobile views.
105
104
 
106
105
  ### Session details
107
106
 
108
- ![Session details dialog with the state sentence, user, session, device, location and security sections and an End session button](pics/dashboardsessionmodal.png)
107
+ ![Session details dialog with the state sentence, user, session, device, location and security sections and an End session button](https://schero94.github.io/Magic-Sessionmanager/img/dashboardsessionmodal.webp)
109
108
 
110
109
  ### Sessions panel in the Content Manager
111
110
 
112
- ![Sessions panel next to a user in the Content Manager, showing Online, two open sessions, End all sessions and Block user](pics/sessioninfopanel.png)
111
+ ![Sessions panel next to a user in the Content Manager, showing Online, two open sessions, End all sessions and Block user](https://schero94.github.io/Magic-Sessionmanager/img/sessioninfopanel.webp)
113
112
 
114
113
  ### Homepage widget
115
114
 
116
- ![Online users widget with the tiles Online users, Active sessions, Idle sessions and Blocked users](pics/widget.png)
115
+ ![Online users widget with the tiles Online users, Active sessions, Idle sessions and Blocked users](https://schero94.github.io/Magic-Sessionmanager/img/widget.webp)
117
116
 
118
117
  ### Configuration
119
118
 
120
- ![Configuration page, Sessions tab, with Session lifetime and Token check cards](pics/settings1.png)
121
-
122
- ![Configuration page, Login protection tab, with Failed sign-ins and Client IP address cards](pics/settings2.png)
123
-
124
- ### Analytics
125
-
126
- ![Analytics page with four KPIs, Devices and Browsers bar cards and the average session length](pics/analytics.png)
119
+ ![Configuration page, Sessions tab, with Session lifetime and Token check cards](https://schero94.github.io/Magic-Sessionmanager/img/settings1.webp)
127
120
 
128
121
  ### Untracked Strapi sign-ins (refresh mode)
129
122
 
130
- ![Neutral notice: 37 older Strapi sign-ins are not tracked, with Why? and End these sessions](pics/untracked-notice-neutral.webp)
123
+ ![Neutral notice: 37 older Strapi sign-ins are not tracked, with Why? and End these sessions](https://schero94.github.io/Magic-Sessionmanager/img/untracked-notice-neutral.webp)
131
124
 
132
- ![Warning notice "Possible tracking gap" with the opened Why? summary: before/after tracking, how Strapi created them, expiry, per month and devices](pics/untracked-disclosure-warning.webp)
125
+ ### Admin panel sessions
133
126
 
134
- ![End untracked Strapi sign-ins confirmation dialog](pics/untracked-confirm-dialog.webp)
127
+ Strapi 5.62, synthetic admins `*.example.test`. The [gallery](https://schero94.github.io/Magic-Sessionmanager/#screenshots) also shows the sessions dialog, the sign-out confirmation, what the signed-out admin sees, dark mode and the phone layout.
128
+
129
+ ![Admin panel sessions: view switch App users / Admin panel, cards Signed-in admins, Not signed in and All admins, an explanation of how signing out works, search, a sign-in status filter and a table of admins with roles, status and last activity](https://schero94.github.io/Magic-Sessionmanager/img/admin-panel.webp)
135
130
 
136
131
  ### Mobile (390 px)
137
132
 
138
- <p>
139
- <img src="pics/mobile-dashboard.png" width="300" alt="Sessions dashboard at 390 px: the table becomes a card list with Details, End session and More buttons">
140
- <img src="pics/mobile-session.png" width="300" alt="Session details dialog at 390 px in one column with Close and End session in the footer">
141
- </p>
133
+ <img src="https://schero94.github.io/Magic-Sessionmanager/img/mobile-dashboard.webp" width="300" alt="Sessions dashboard at 390 px: the table becomes a card list with Details, End session and More buttons">
142
134
 
143
135
  ---
144
136
 
@@ -177,14 +169,15 @@ All screenshots use synthetic data: users `*.example.test`, IP addresses from th
177
169
 
178
170
  ## Screens
179
171
 
180
- | Where | Name | Answers |
181
- | ------------------------------- | ------------------------------------------- | --------------------------------------------------------- |
182
- | Main menu | **Session Manager** (page title "Sessions") | Which sessions exist, and which need action? |
183
- | Dialog on the dashboard | **Session details** | What is this session, and why is it in this state? |
184
- | Content Manager, User edit view | **Sessions** panel | What access does this user have, and how do I cut it off? |
185
- | Strapi homepage | **Online users** widget | Who is online right now? |
186
- | Settings › Session Manager | **Configuration** | How should sessions and sign-ins behave? |
187
- | Settings › Session Manager | **Analytics** | How are sessions used over time and by device? |
172
+ | Where | Name | Answers |
173
+ | ------------------------------- | ------------------------------------------- | -------------------------------------------------------------------- |
174
+ | Main menu | **Session Manager** (page title "Sessions") | Which sessions exist, and which need action? |
175
+ | Dialog on the dashboard | **Session details** | What is this session, and why is it in this state? |
176
+ | Content Manager, User edit view | **Sessions** panel | What access does this user have, and how do I cut it off? |
177
+ | Strapi homepage | **Online users** widget | Who is online right now? |
178
+ | Session Manager › Admin panel | **Admin panel sessions** | Who is signed in to this admin panel, and how do I sign someone out? |
179
+ | Settings › Session Manager | **Configuration** | How should sessions and sign-ins behave? |
180
+ | Settings › Session Manager | **Analytics** | How are sessions used over time and by device? |
188
181
 
189
182
  ### Sessions dashboard
190
183
 
@@ -198,6 +191,19 @@ All screenshots use synthetic data: users `*.example.test`, IP addresses from th
198
191
  - In `refresh` mode, a notice above the cards counts **untracked Strapi sign-ins**: refresh tokens Strapi still accepts that have no session details from this plugin. They are not in the list and are not active or online sessions; each user's sessions panel lists them. The notice is neutral when all of them were created before this plugin started tracking, and a warning ("Possible tracking gap") when any was created afterwards. **Why?** opens a count-only summary; **End these sessions** ends them after a confirmation. See [Untracked Strapi sessions](#untracked-strapi-sessions).
199
192
  - Below the large breakpoint the IP address and Signed in columns are hidden; below the medium breakpoint the table becomes a card list.
200
193
 
194
+ ### Admin panel sessions
195
+
196
+ Open **Session Manager** and switch to **Admin panel** (the switch below the title; shown only to roles with "Read admin panel sessions"). The view lists Strapi admin accounts, not your app's users, and none of its numbers appear on the App users dashboard, the widget or Analytics.
197
+
198
+ - **Cards:** **Signed-in admins** (with the number of signed-in browsers), **Not signed in** (including deactivated and invited accounts) and **All admins** (with the number of active accounts). Each card filters the list.
199
+ - **How signing out works:** signing out takes effect on the admin's next click, because Strapi checks the admin session on every admin request. The admin can sign in again with their password; to stop that, deactivate the account in Settings › Users (**Manage admins** in the header). The card also shows the idle timeouts your host runs with (`admin.auth.sessions`).
200
+ - **Search and filter:** name or email; **All admins**, **Signed in**, **Not signed in**. Search, filter and paging run on the server and live in the URL.
201
+ - **Table** (cards below 768 px): Admin (with a **You** badge), Roles, Status (**Signed in** · "{n} sessions", **Not signed in**, **Deactivated**, **Invited**), Last active, and the actions **View sessions** and **Sign out everywhere**.
202
+ - **Sessions of an admin:** one entry per signed-in browser with Strapi's device label (for example "Chrome on macOS"), **This browser**, **Remember me**, Signed in, Last active and **Ends at the latest**. **Sign out** ends that browser, **Sign out everywhere** ends all of them, **Manage in Settings** opens the admin in Settings › Users.
203
+ - **Confirmation:** every sign-out asks first. Signing yourself out of the browser you are using shows a warning; you are then taken to the login page.
204
+ - **Protection:** an admin without the Super Admin role cannot sign out a Super Admin, so the last active Super Admin can never be signed out by someone else. The view explains this instead of showing a disabled button.
205
+ - Strapi stores no IP address and no full user agent for admin sessions, so the view shows none. "Last active" is the last time the browser renewed its access token (Strapi's own signal), not every click.
206
+
201
207
  ### Session details
202
208
 
203
209
  - A state sentence that explains why the session is in its state, for example "Ended {time} · Ended manually."
@@ -242,16 +248,17 @@ Two links: **Configuration** and **Analytics**.
242
248
 
243
249
  ## Compatibility
244
250
 
245
- | Item | Supported |
246
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
247
- | Strapi | 5 (`@strapi/strapi` peer range `^5.0.0`). Acceptance host: Strapi 5.61.0. |
248
- | Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) |
249
- | Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` |
250
- | Homepage widget | Strapi 5.13 and later (older versions have no widgets API; the rest works) |
251
- | 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. |
252
- | 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. |
253
- | Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. |
254
- | Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). |
251
+ | Item | Supported |
252
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
+ | Strapi | 5 (`@strapi/strapi` peer range `^5.0.0`). Acceptance host: Strapi 5.62.0. |
254
+ | Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) |
255
+ | Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` |
256
+ | Homepage widget | Strapi 5.13 and later (older versions have no widgets API; the rest works) |
257
+ | 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. |
258
+ | 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. |
259
+ | 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. |
260
+ | Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. |
261
+ | Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). |
255
262
 
256
263
  ---
257
264
 
@@ -621,30 +628,41 @@ module.exports = factories.createCoreRouter('api::order.order', {
621
628
 
622
629
  ## Admin API and permissions
623
630
 
624
- Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authenticated Strapi admin **and** the permission `plugin::magic-sessionmanager.access` ("Access the Session Manager plugin"). The same permission controls the menu link, the settings links, the widget and the user panel. Admin responses never contain tokens or the internal `sessionId`.
625
-
626
- | Method | Path | Admin UI action |
627
- | -------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
628
- | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
629
- | GET | `/sessions/active` | Active sessions only; same paging parameters |
630
- | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
631
- | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
632
- | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
633
- | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
634
- | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
635
- | GET | `/user/:userId/sessions` | Sessions panel |
636
- | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
637
- | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
638
- | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
639
- | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
640
- | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
641
- | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
642
- | GET | `/geolocation/:ipAddress` | **Look up location** |
643
- | GET | `/geoip/status` | GeoIP database status |
644
- | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
645
- | POST | `/geoip/update` | Update database / Force download |
646
- | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input) |
647
- | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
631
+ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authenticated Strapi admin **and** the permission `plugin::magic-sessionmanager.access` ("Access the Session Manager plugin"). The same permission controls the menu link, the settings links, the widget and the user panel. Admin responses never contain tokens or the internal `sessionId` of a Users & Permissions session.
632
+
633
+ The **Admin panel sessions** routes need two more permissions, which only the Super Admin role has by default (Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel):
634
+
635
+ | Permission | Name in the role editor | Allows |
636
+ | ---------------------------------------------------- | ------------------------- | ---------------------------------------------------------- |
637
+ | `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
638
+ | `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
639
+
640
+ | Method | Path | Admin UI action |
641
+ | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
642
+ | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
643
+ | GET | `/sessions/active` | Active sessions only; same paging parameters |
644
+ | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
645
+ | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
646
+ | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
647
+ | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
648
+ | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
649
+ | GET | `/user/:userId/sessions` | Sessions panel |
650
+ | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
651
+ | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
652
+ | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
653
+ | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
654
+ | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
655
+ | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
656
+ | GET | `/geolocation/:ipAddress` | **Look up location** |
657
+ | GET | `/geoip/status` | GeoIP database status |
658
+ | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
659
+ | POST | `/geoip/update` | Update database / Force download |
660
+ | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input) |
661
+ | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
662
+ | GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
663
+ | GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
664
+ | POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
665
+ | POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
648
666
 
649
667
  **Session list parameters.** `page` (from 1), `pageSize` (1-100), `status` (`all`, `open`, `active`, `idle`, `ended`), `reason` (with `status=ended`: `logout`, `idle`, `expired`, `manual`, `blocked`, `unrecorded`), `search` (up to 100 characters; matches email, username, IP address, browser, operating system and device type) and `sort` (`loginTime:desc`, `loginTime:asc`, `lastActive:desc`, `lastActive:asc`). The response is `{ data, meta: { pagination: { page, pageSize, total, pageCount } } }` with exact totals. Unknown or out-of-range parameters return 400. Pages that start after the first 50,000 matching sessions return 400; narrow the filter or use the export, which walks every row with a cursor. Without `page` and `pageSize`, `GET /sessions` keeps the 4.x response (latest 1,000 rows, `meta.truncated`) for existing scripts.
650
668
 
@@ -654,6 +672,10 @@ The list, statistics, analytics, export, untracked-session summary and `/users/s
654
672
 
655
673
  **Block / unblock** (`toggle-block`): send `{ "blocked": true }` or `{ "blocked": false }`. This sets the state, is safe to retry and is what the admin UI sends. A request without a body still toggles, but is deprecated, because a retry after a lost response can reverse the intended state. A non-boolean `blocked` returns 400. The response contains `blocked` and `mode` (`explicit` or `toggle`). Blocking ends all open sessions with the reason `blocked`; if that fails, the response is 500 and the request can be retried.
656
674
 
675
+ **Admin panel sessions.** `GET /admin-sessions/admins` returns `{ data: [{ id, name, email, roles: [{ name, superAdmin }], account, self, sessionCount, lastActiveAt, canSignOut, protectedReason }], meta: { supported, pagination, stats: { signedInAdmins, activeSessions, activeAccounts, totalAdmins }, policy, truncated } }`. `account` is `active`, `deactivated` or `invited`. `GET …/sessions` returns `{ data: [{ id, device, signedInAt, lastActiveAt, endsAt, rememberMe, current }], meta: { admin, policy } }`; `id` is the Strapi session id of the browser's newest session record (32 hexadecimal characters). No token, refresh token, device id or password field is ever returned. Both sign-out routes return `{ data: { ended, signedOutSelf } }`: `signedOutSelf` is `true` when the browser that sent the request was signed out. Answers: 404 for an unknown admin, and for a session id that is not a live session of that admin (no probing of other admins' sessions); 403 with `error.details.reason` `super-admin-protected` when an admin without the Super Admin role tries to sign out a Super Admin, or `browser-session-required` for admin API tokens; 429 after 10 sign-outs per minute per admin; 503 when the Strapi version has no session manager (`meta.supported: false` on the GET routes). Each sign-out writes one log line, `[magic-sessionmanager] Admin sign-out: actor=<admin id> target=<admin id> scope=one|all ended=<n>`, at info level (no email, session id or token), and emits the Strapi event `magic-sessionmanager.admin-sessions.signed-out` with the same fields.
676
+
677
+ **How a sign-out works (Strapi 5.62).** The plugin deletes Strapi's own session records of that browser (`strapi.sessionManager('admin').invalidateRefreshToken(adminId, deviceId)`, the same call Strapi's logout makes) or of every browser (`invalidateRefreshToken(adminId)`). Strapi's admin authentication checks the session record on every admin request (`isSessionActive`), so the admin's next request returns 401 and the admin panel cannot renew its token: it shows the login page. There is no waiting period for the 30-minute access token (`accessTokenLifespan`). The plugin deletes every record of the browser, not only the newest one: an older access token belongs to an older, rotated record, and deleting just the newest record (`revokeSessionById`) would leave that token working until it expires. The integration suite proves both. Admin API tokens (Settings › Admin tokens) are separate from sessions and are not affected.
678
+
657
679
  Errors use Strapi's `{ data: null, error }` envelope: 400 for invalid input, 404 for unknown IDs, 500 for server-side failures, 502 for a failed MaxMind download, 409 for a settings save based on an outdated `revision`.
658
680
 
659
681
  ---
@@ -843,7 +865,7 @@ The plugin sits in the request path of every authenticated Content API call, so
843
865
  - **What leaves your server.** Only what you turn on: IP lookups at ipapi.co (provider `auto` without a local database, or `ipapi`), Discord or Slack webhooks (Team notifications), emails through your own Email provider (Security emails) and the MaxMind database download when you click **Update database** or run the updater. There is no telemetry, no install ping and no license check.
844
866
  - **Reporting a vulnerability.** Please do not post exploit details in a public issue. Open an issue that asks for a private contact, or use the email address on the maintainer's GitHub profile, and you will get a reply before anything is published.
845
867
  - **Secrets.** MaxMind license keys are never returned to the browser. Webhook URLs grant posting rights to your channel; treat them as secrets. Exports never contain tokens.
846
- - **Admin sessions** of Strapi administrators are out of scope.
868
+ - **Admin panel sessions.** The Admin panel view reads Strapi's own `admin::session` records (origin `admin`) and stores nothing of its own: no IP address, user agent or sign-in history. Only Super Admin can see or sign out admins until another role is granted `admin-sessions.read` / `admin-sessions.revoke`; a delegated role cannot sign out a Super Admin. Sign-outs need a signed-in administrator (not an admin API token), are rate limited and logged with admin ids and counts only.
847
869
 
848
870
  ---
849
871
 
@@ -852,7 +874,8 @@ The plugin sits in the request path of every authenticated Content API call, so
852
874
  | Problem | Fix |
853
875
  | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
854
876
  | No Session Manager menu item | Check `config/plugins.ts`, run `npm run build`, restart, hard-refresh the browser. For non-Super-Admin roles, grant "Access the Session Manager plugin". |
855
- | No sessions appear | Only end-user sign-ins through Users & Permissions are recorded, not Strapi admin sign-ins. Check the Strapi log. |
877
+ | No **Admin panel** switch on the Session Manager page | Your role needs "Read admin panel sessions" (Settings › Roles › Plugins › Session Manager). Super Admin has it by default. |
878
+ | No sessions appear | Only end-user sign-ins through Users & Permissions are recorded on this dashboard; Strapi admin sign-ins are under **Admin panel**. Check the Strapi log. |
856
879
  | Startup fails with `SESSION_ENCRYPTION_KEY is required in production` | Set the variable and restart. |
857
880
  | 401 on every request after a sign-in | Check the `X-Session-Terminated-Reason` header. With Strict token check, tokens without a session record are rejected. |
858
881
  | 429 on sign-in | Temporary IP lockout. Wait 15 minutes or raise `maxFailedLogins`. Behind a proxy, turn on Trust proxy headers so the lockout targets the real client. With `Retry-After: 1`: more sign-ins from one address were running at once than `maxFailedLogins`; retry after a second. |
@@ -867,7 +890,10 @@ The plugin stores sessions in the `magic_sessions` table and revocations in its
867
890
  ## FAQ
868
891
 
869
892
  **Does it manage Strapi admin accounts?**
870
- No. It manages end users of Users & Permissions (`plugin::users-permissions.user`). Strapi administrator sessions are out of scope.
893
+ It shows who is signed in to the Strapi admin panel and signs admins out (**Admin panel** view). It does not create, edit or deactivate admin accounts; that stays in Strapi's Settings › Users. Everything else in the plugin is about end users of Users & Permissions (`plugin::users-permissions.user`).
894
+
895
+ **When does signing out an admin take effect?**
896
+ On the admin's next request, usually their next click: Strapi 5.62 checks the session record on every admin request. They can sign in again with their password unless you deactivate the account in Settings › Users.
871
897
 
872
898
  **Do I need a license key, account or activation?**
873
899
  No. Everything is free under MIT, and the plugin does not contact any license or telemetry server. The only key you may add is your own MaxMind key for the GeoLite2 database.
@@ -930,7 +956,14 @@ npm run verify
930
956
  npm run verify:runtime
931
957
  ```
932
958
 
933
- HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message.
959
+ HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message. This repository's own `node_modules` works (its devDependencies include Strapi 5.62 and Users & Permissions), which is what CI uses:
960
+
961
+ ```bash
962
+ SESSION_HTTP_REQUIRED=1 SESSION_HTTP_STRAPI_NODE_MODULES=$PWD/node_modules node --test tests/isolated-admin-sessions-http.test.js
963
+ # PostgreSQL: add SESSION_HTTP_DB=postgres MSM_TEST_PG_URL=postgres://user:pass@127.0.0.1:5432/db
964
+ ```
965
+
966
+ The admin panel suite signs synthetic admins in through `POST /admin/login` and checks listing, signing out one browser and everywhere, self sign-out, the Super Admin guard, RBAC denials, the rate limit, that the next request and the refresh are rejected, and that admin sessions never reach the app-user numbers.
934
967
 
935
968
  Quick manual check: sign in to your app as an end user (`POST /api/auth/local`), open Session Manager and find the session as **Active**, click **End session** and confirm, then call any Content API route with the same token: it returns 401 and the row shows **Ended · Ended manually**.
936
969
 
@@ -952,9 +985,9 @@ Issues and pull requests are welcome.
952
985
 
953
986
  Actively maintained for the Strapi 5 line. Releases are cut by semantic-release from `main` using Conventional Commits and published to npm with npm Trusted Publishing (GitHub OIDC). Dependabot proposes weekly dependency updates; patch and minor updates are merged only after lint, tests, both type checks, build and `verify` pass.
954
987
 
955
- Dependency advisories: the remaining high-severity findings come through the Strapi 5 core dependency chain (`braces` GHSA-vfj7-8cjw-p6xm, Zod GHSA-mrhx-c7xc-m3w5 via `@strapi/utils` 5.61.0). The plugin cannot fix them; the forced npm fix would downgrade to Strapi 4, so it is not applied.
988
+ Dependency advisories (checked 2026-11-17, Strapi 5.62.0 dev baseline): `npm audit --omit=dev` on the plugin lockfile reports 5 high findings. All of them are one advisory in the Strapi 5 core dependency chain, picomatch [GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf) through `@strapi/utils` > `preferred-pm` > `find-yarn-workspace-root2` > `micromatch`. The plugin cannot fix findings in that chain; the forced npm fix would downgrade to Strapi 4, so it is not applied. They clear when Strapi ships an updated `@strapi/utils`.
956
989
 
957
- Version 4.8.0 was published before its acceptance gates closed and has known defects that 4.9.0 fixed (see the [CHANGELOG](CHANGELOG.md)). Use 4.9.0 or later.
990
+ Version 4.8.0 was published before its acceptance gates closed and has known defects that 4.9.0 fixed (see the [CHANGELOG](https://github.com/Schero94/Magic-Sessionmanager/blob/main/CHANGELOG.md)). Use 4.9.0 or later.
958
991
 
959
992
  Report bugs at https://github.com/Schero94/Magic-Sessionmanager/issues.
960
993
 
@@ -968,4 +1001,4 @@ The admin interface is available in English, German (formal "Sie"), French, Span
968
1001
 
969
1002
  ## License
970
1003
 
971
- MIT License. Copyright © 2025 Schero D. See [LICENSE](./LICENSE).
1004
+ MIT License. Copyright © 2025 Schero D. See [LICENSE](https://github.com/Schero94/Magic-Sessionmanager/blob/main/LICENSE).
@@ -9,7 +9,7 @@ const styled = require("styled-components");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
11
  const symbols = require("@strapi/icons/symbols");
12
- const index = require("./index-DyE1rLW0.js");
12
+ const index = require("./index-BBZNey0n.js");
13
13
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -7,7 +7,7 @@ import styled from "styled-components";
7
7
  import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
8
8
  import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
9
9
  import { EmptyDocuments } from "@strapi/icons/symbols";
10
- import { J as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, v as PageShell, w as StatGrid, x as StatCard, F as EqualGrid, b as getTranslation, K as getDeviceTypeMessage } from "./index-mCVi1j7e.mjs";
10
+ import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-BcQdNWzu.mjs";
11
11
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
12
12
  const ANALYTICS_UNKNOWN_KEY = "unknown";
13
13
  const VERSION_TOKEN = /^v?\d[\w.]*$/i;