strapi-plugin-magic-sessionmanager 4.15.0 → 4.16.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.
- package/CHANGELOG.md +39 -0
- package/README.md +91 -7
- package/dist/admin/{Analytics-HK6_TEmk.mjs → Analytics-D4gsVwL0.mjs} +1 -1
- package/dist/admin/{Analytics-Dbs5QXLb.js → Analytics-me4qzS0I.js} +1 -1
- package/dist/admin/{App-BOFzZ5d8.mjs → App-BJwtFWxl.mjs} +863 -81
- package/dist/admin/{App-7SxOBJP5.js → App-BTG-2Q26.js} +862 -80
- package/dist/admin/{OnlineUsersWidget-Dns_74xJ.js → OnlineUsersWidget-DYS3Vy1Q.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-CoCxnww-.mjs → OnlineUsersWidget-Yd283YDy.mjs} +1 -1
- package/dist/admin/{Settings-DYRShQ8W.mjs → Settings-DIlvfdjZ.mjs} +170 -19
- package/dist/admin/{Settings-B6CrR-07.js → Settings-TPZ9_75s.js} +169 -18
- package/dist/admin/{de-bkkCvSxX.js → de-BuMw1gBJ.js} +92 -2
- package/dist/admin/{de-B3mPtxsW.mjs → de-DB9ldYwN.mjs} +92 -2
- package/dist/admin/{en-BnU8BNkN.mjs → en-BbLMPQB3.mjs} +92 -2
- package/dist/admin/{en-DMICyIow.js → en-BqGhOJDy.js} +92 -2
- package/dist/admin/{es-OSzHGRIu.js → es-BaIeckl9.js} +92 -2
- package/dist/admin/{es-BxMgfJ1Y.mjs → es-C5iaiE9G.mjs} +92 -2
- package/dist/admin/{fr-WPrbtx8k.mjs → fr-BEvBUCwI.mjs} +92 -2
- package/dist/admin/{fr-Bu_8miJ4.js → fr-D1YKyTex.js} +92 -2
- package/dist/admin/{index-CNSJITRX.js → index-CgZiLcJ1.js} +13 -10
- package/dist/admin/{index-lnZBc5n0.mjs → index-DUESEUaO.mjs} +13 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-C41KyEDN.mjs → pt-DeDih9cR.mjs} +92 -2
- package/dist/admin/{pt-B08xnb0K.js → pt-DtnW-s0V.js} +92 -2
- package/dist/server/index.js +1917 -103
- package/dist/server/index.mjs +1917 -103
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
# [4.16.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.15.0...v4.16.0) (2026-11-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* admin sign-in history with IP, Content Manager activity and a security event log ([#34](https://github.com/Schero94/Magic-Sessionmanager/issues/34)) ([ca53128](https://github.com/Schero94/Magic-Sessionmanager/commit/ca53128efb31b9293d9c45ddcb03ac041242ca56))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Release type: minor (`feat`). Additive: a new content type, four new GET routes, one new permission and new settings keys; no existing route, response or setting changes.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
* **Security log** (`plugin::magic-sessionmanager.security-event`, table `magic_sessions_security_events`, hidden from the Content Manager and the Content-Type Builder). One row per event with `actorType`/`actorId`, `targetType`/`targetId`, `event`, `ip`, `userAgent`, `geo`, a bounded `meta` (at most 16 plain values, 2 KB) and `createdAt`, indexed on actor, target, event and time. Event names are an extendable registry (`admin.sign-in`, `admin.sign-in.failed`, `admin.lockout`, `admin.sign-out`, `admin.session.revoked`, `admin.content.*`), so later app-user events can use the same log.
|
|
14
|
+
* **Admin sign-in history** (on by default): every admin sign-in (local and SSO, from Strapi's `admin.auth.success` event), failed attempt with Strapi's reason (`admin.auth.error`; linked to an admin only when the typed email belongs to one, the typed email itself is never stored), lockout (Strapi's login rate limit, 429), sign-out (`admin.logout`), first sign-in after registration and after a password reset, and every **Sign out** / **Sign out everywhere** in this plugin with the admin who did it. Stored with IP address (`ctx.request.ip`), user agent and, when IP location lookup is on, country and city.
|
|
15
|
+
* **Content Manager activity** (off by default): which entries each admin opened, created, edited, published, unpublished, discarded, duplicated or deleted, with content type, document id, locale and title. Opening the same entry again within 10 minutes is one event; list views and polling are not recorded.
|
|
16
|
+
* **Admin panel view:** the admin details dialog has the tabs **Sessions**, **Sign-in history** and **Activity**, with filters (event or action, content type, period), **Show more** and **Export CSV**. A **Recent sign-in activity** card under the table lists the latest five events of all admins. Shown to roles with the new permission **View admin activity** (`plugin::magic-sessionmanager.admin-activity.read`); only Super Admin has it at first.
|
|
17
|
+
* **Configuration › Admin activity** (with the same permission): Record admin sign-ins, Record Content Manager activity (with a note on informing employees and the works council), Store IP addresses, Anonymise the last part of IP addresses (IPv4 /24, IPv6 /48) and Keep security events for (1-730 days, default 90). IP storage, anonymisation and retention apply to the whole log.
|
|
18
|
+
* Admin routes `GET /admin-activity/sign-ins`, `/admin-activity/sign-ins/export`, `/admin-activity/content`, `/admin-activity/content/export` (need `access`, `admin-sessions.read` and `admin-activity.read`; read rate limit). `GET /admin-sessions/admins` adds `meta.recording`.
|
|
19
|
+
* A daily retention job (`strapi.cron`, one process per cluster) deletes older events; deleting an admin account deletes that admin's events.
|
|
20
|
+
* README: how events are captured, the reverse-proxy setup for correct client IPs (`server.proxy.koa`, `maxIpsCount`, `ipHeader`), the privacy defaults and legal notes (GDPR, German works council; information, not legal advice), and a latency bench (`scripts/bench-admin-activity.cjs`): no measurable difference with recording on.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
* The "How signing out works" note no longer says that admin sessions record no IP address; it says what the sign-in history records with the current settings.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
* Enter and Space on the row buttons of the Admin panel table (View sessions, Sign out everywhere) did nothing: the Design System grid table handled the keys. They now open the dialog and the confirmation, as in the App users table.
|
|
29
|
+
* A settings load that started before a settings change could cache the old values in that process until the next revision check (up to 2 seconds).
|
|
30
|
+
|
|
31
|
+
### Migration
|
|
32
|
+
|
|
33
|
+
* Nothing to do. Strapi creates the new table and indexes on the first start. Admin sign-ins are recorded from then on (with IP addresses); to keep the previous behaviour, turn off **Record admin sign-ins** in Configuration › Admin activity. Behind a reverse proxy set `server.proxy.koa: true` and `maxIpsCount`, otherwise the proxy's address is stored.
|
|
34
|
+
|
|
35
|
+
### Tests
|
|
36
|
+
|
|
37
|
+
* `tests/isolated-admin-activity-http.test.js` boots Strapi from this checkout and covers sign-in, failed sign-in, lockout, sign-out and sign-out by another admin, session states, IP with and without a trusted proxy (`ADMIN_ACTIVITY_PROXY=1`), view de-duplication, every write action, RBAC (401/403/200), settings permission and validation, anonymisation, switches off, retention and deletion with the admin. CI runs it in both proxy modes and on the Strapi 5.50 floor.
|
|
38
|
+
* Unit tests for the event model, the queue and flush, IP anonymisation, bounded meta and the settings cache race; StrictMode tests for the new dialog tabs, recent list and settings tab; a keyboard test for the table row buttons.
|
|
39
|
+
|
|
1
40
|
# [4.15.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.3...v4.15.0) (2026-11-24)
|
|
2
41
|
|
|
3
42
|
|
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
|
|
|
41
41
|
- [Examples](#examples)
|
|
42
42
|
- [Optional route policy: `session-required`](#optional-route-policy-session-required)
|
|
43
43
|
- [Admin API and permissions](#admin-api-and-permissions)
|
|
44
|
+
- [Admin activity and sign-in history](#admin-activity-and-sign-in-history)
|
|
44
45
|
- [Running several instances (Railway replicas, pm2 cluster)](#running-several-instances-railway-replicas-pm2-cluster)
|
|
45
46
|
- [Performance](#performance)
|
|
46
47
|
- [Security and privacy](#security-and-privacy)
|
|
@@ -68,6 +69,7 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
|
|
|
68
69
|
| Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
|
|
69
70
|
| Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
|
|
70
71
|
| 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. |
|
|
72
|
+
| Admin activity | A sign-in history per admin (sign-ins, failed attempts, lockouts, sign-outs, who signed out whom) with IP address, browser and location, and optional Content Manager activity. |
|
|
71
73
|
| Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
|
|
72
74
|
| Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
|
|
73
75
|
| Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
|
|
@@ -203,7 +205,8 @@ Open **Session Manager** and switch to **Admin panel** (the switch below the tit
|
|
|
203
205
|
- **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.
|
|
204
206
|
- **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.
|
|
205
207
|
- **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.
|
|
206
|
-
-
|
|
208
|
+
- **Sign-in history and activity** (roles with "View admin activity"): the details dialog gets three tabs, **Sessions**, **Sign-in history** and **Activity**. The history lists sign-ins with IP address, location, browser and operating system and whether that session is **Still signed in**, **Signed out** (and by whom) or **Session ended**, plus failed attempts with the reason, lockouts and sign-outs. **Activity** lists the entries the admin opened, created, edited, published, unpublished, discarded or deleted in the Content Manager, each with a link to the entry. Both tabs filter by event or action, content type and period, page with **Show more** and offer **Export CSV**. A **Recent sign-in activity** card under the table shows the latest five events of all admins, including failed sign-ins with an unknown email ("Unknown account"). See [Admin activity and sign-in history](#admin-activity-and-sign-in-history).
|
|
209
|
+
- "Last active" is the last time the browser renewed its access token (Strapi's own signal), not every click. Strapi's own session records hold no IP address; the IP addresses in the sign-in history come from the plugin's security log.
|
|
207
210
|
|
|
208
211
|
### Session details
|
|
209
212
|
|
|
@@ -231,7 +234,7 @@ Part of every supported Strapi version (the widgets API exists since Strapi 5.13
|
|
|
231
234
|
|
|
232
235
|
Two links: **Configuration** and **Analytics**.
|
|
233
236
|
|
|
234
|
-
**Configuration** has five tabs, deep-linkable with `?tab=sessions|login-protection|location-data|alerts|data-retention
|
|
237
|
+
**Configuration** has five tabs, deep-linkable with `?tab=sessions|login-protection|location-data|alerts|data-retention`, and a sixth, `admin-activity`, for roles with "View admin activity":
|
|
235
238
|
|
|
236
239
|
| Tab | Question | Contents |
|
|
237
240
|
| ---------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -240,6 +243,7 @@ Two links: **Configuration** and **Analytics**.
|
|
|
240
243
|
| **Location data** | Where do IP location and risk data come from? | IP location lookup, Security scoring, Provider, GeoIP database status, MaxMind credentials, Update database / Force download, Risk data (GeoIP2 Anonymous IP, GeoLite2 ASN heuristic). |
|
|
241
244
|
| **Alerts** | Who is told about sign-ins? | Security emails to users (with email templates) and Team notifications to Discord or Slack. |
|
|
242
245
|
| **Data and retention** | How long is session history kept? | Keep ended sessions for, and **Delete ended sessions**. |
|
|
246
|
+
| **Admin activity** | What is recorded about admins, and how long? | Record admin sign-ins, Record Content Manager activity (with a note on informing employees and the works council), Store IP addresses, Anonymise the last part of IP addresses, Keep security events for. |
|
|
243
247
|
|
|
244
248
|
**Save** applies the whole form; **Discard changes** re-loads the stored values (it does not restore defaults). Leaving with unsaved changes asks first. Settings are saved in the database; other server processes apply them within 30 seconds.
|
|
245
249
|
|
|
@@ -680,10 +684,11 @@ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authe
|
|
|
680
684
|
|
|
681
685
|
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):
|
|
682
686
|
|
|
683
|
-
| Permission | Name in the role editor | Allows
|
|
684
|
-
| ---------------------------------------------------- | ------------------------- |
|
|
685
|
-
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes
|
|
686
|
-
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read)
|
|
687
|
+
| Permission | Name in the role editor | Allows |
|
|
688
|
+
| ---------------------------------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
689
|
+
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
|
|
690
|
+
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
|
|
691
|
+
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent sign-in activity, CSV exports and changing the Admin activity settings (also needs read) |
|
|
687
692
|
|
|
688
693
|
| Method | Path | Admin UI action |
|
|
689
694
|
| -------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -711,6 +716,10 @@ The **Admin panel sessions** routes need two more permissions, which only the Su
|
|
|
711
716
|
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
|
|
712
717
|
| POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
713
718
|
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
719
|
+
| GET | `/admin-activity/sign-ins` | **Sign-in history** and **Recent sign-in activity**: `adminId`, `event` (`all`, `succeeded`, `failed`, `signed-out`), `from`, `to` (ISO dates), `page`, `pageSize` (1-100); needs `admin-activity.read` |
|
|
720
|
+
| GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor` |
|
|
721
|
+
| GET | `/admin-activity/content` | **Activity**: `adminId`, `action` (`all`, `view`, `create`, `update`, `publish`, `unpublish`, `discard`, `delete`, `clone`), `contentType` (uid), `from`, `to`, `page`, `pageSize`; needs `admin-activity.read` |
|
|
722
|
+
| GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor` |
|
|
714
723
|
|
|
715
724
|
**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.
|
|
716
725
|
|
|
@@ -728,6 +737,75 @@ Errors use Strapi's `{ data: null, error }` envelope: 400 for invalid input, 404
|
|
|
728
737
|
|
|
729
738
|
---
|
|
730
739
|
|
|
740
|
+
## Admin activity and sign-in history
|
|
741
|
+
|
|
742
|
+
Since 4.15 the plugin keeps a **security log**: one table (`plugin::magic-sessionmanager.security-event`, collection `magic_sessions_security_events`, hidden from the Content Manager and the Content-Type Builder) where every event has an actor (`actorType` `admin`/`user`/`system`, `actorId`), a target (`targetType`, `targetId`), an `event` name, `ip`, `userAgent`, `geo`, a small `meta` object (at most 16 plain values, 2 KB) and `createdAt`. It is indexed on actor, target, event and time. The admin panel uses it for two things:
|
|
743
|
+
|
|
744
|
+
| Recorded | Events | Default |
|
|
745
|
+
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
746
|
+
| **Admin sign-in history** | `admin.sign-in`, `admin.sign-in.failed` (reason), `admin.lockout`, `admin.sign-out`, `admin.session.revoked` (who signed out whom, one browser or everywhere) | On |
|
|
747
|
+
| **Content Manager activity** | `admin.content.view` (opening an entry), `.create`, `.update`, `.publish`, `.unpublish`, `.discard`, `.delete`, `.clone`, with content type, document id, locale and title | **Off** |
|
|
748
|
+
|
|
749
|
+
**Who can see it.** The new permission **View admin activity** (`plugin::magic-sessionmanager.admin-activity.read`, together with `access` and `admin-sessions.read`). Only the Super Admin role has it until you grant it in Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel. The same permission is needed to change the settings below; other admins can still save the Configuration page, but not change these values (403).
|
|
750
|
+
|
|
751
|
+
### How events are captured (Strapi 5.63)
|
|
752
|
+
|
|
753
|
+
- **Sign-ins and failures** come from Strapi's own event hub events `admin.auth.success` and `admin.auth.error`, the events behind the documented `admin.auth.events.onConnectionSuccess` / `onConnectionError` callbacks ([Admin panel configuration](https://docs.strapi.io/cms/configurations/admin-panel)). They cover local and SSO sign-ins. For a failed attempt Strapi itself resolves the account; the plugin stores that admin id only when the typed email belongs to an existing admin, and never the typed email, the password or the request body.
|
|
754
|
+
- **Sign-outs** come from `admin.logout`; **"Sign out" / "Sign out everywhere"** in this plugin record `admin.session.revoked` with the acting admin and the target admin.
|
|
755
|
+
- **Lockouts** are Strapi's `admin::rateLimit` answering 429 on `POST /admin/login` (by default 5 attempts per 5 minutes per email and address, `admin.rateLimit`). Repeated 429s within 5 minutes are one event.
|
|
756
|
+
- **Registration and password reset** create a session without an event; a small server middleware records them as sign-ins.
|
|
757
|
+
- **Content Manager activity** is recorded by the same middleware after the Content Manager has answered: only successful calls of a signed-in admin to the entry routes (`collection-types` findOne, create, update, publish, unpublish, discard, delete, clone and bulk actions, and the single-type routes). List views, counts, relations and configuration calls are not activity. Opening the same entry (same admin, content type, document and locale) again within 10 minutes, or right after editing it, is one event.
|
|
758
|
+
- The request behind an event is read from Strapi's request context (`strapi.requestContext`), which is how the IP address and user agent reach the event hub listeners.
|
|
759
|
+
- Nothing is written on the request path. Events go to a bounded in-memory queue and are written in batches about once a second; GeoIP lookups also happen there. The settings are read when the batch is written, so a switched-off recording drops queued events.
|
|
760
|
+
|
|
761
|
+
### Client IP address and reverse proxies
|
|
762
|
+
|
|
763
|
+
The stored address is Strapi's client IP, `ctx.request.ip`. Koa takes it from the socket unless you trust your proxy; the plugin never reads `X-Forwarded-For` itself. Behind a reverse proxy or load balancer set, in `config/server.js`:
|
|
764
|
+
|
|
765
|
+
```js
|
|
766
|
+
module.exports = ({ env }) => ({
|
|
767
|
+
// ...
|
|
768
|
+
proxy: {
|
|
769
|
+
koa: true, // trust X-Forwarded-* from your proxy
|
|
770
|
+
maxIpsCount: 1, // number of proxies in front of Strapi (5.52+); 0 means unlimited and lets clients spoof
|
|
771
|
+
// ipHeader: 'CF-Connecting-IP', // only if your proxy sends another header (5.52+)
|
|
772
|
+
},
|
|
773
|
+
});
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
Without `proxy.koa` every event shows the proxy's address. The integration suite runs once without and once with a trusted proxy (`ADMIN_ACTIVITY_PROXY=1`) and checks both.
|
|
777
|
+
|
|
778
|
+
### Settings (Configuration › Admin activity)
|
|
779
|
+
|
|
780
|
+
| Setting | Key | Default | Notes |
|
|
781
|
+
| --------------------------------------- | -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
782
|
+
| Record admin sign-ins | `adminSignInHistory` | On | Sign-ins, failures, lockouts, sign-outs, who signed out whom. |
|
|
783
|
+
| Record Content Manager activity | `adminContentActivity` | **Off** | Records how people work; read the notes below before you turn it on. |
|
|
784
|
+
| Store IP addresses | `securityLogStoreIp` | On | Applies to the whole security log. Location uses the IP location lookup under Location data (local MaxMind database or ipapi.co). |
|
|
785
|
+
| Anonymise the last part of IP addresses | `securityLogAnonymizeIp` | Off | Stores `203.0.113.0` instead of `203.0.113.42`; IPv6 keeps the first 48 bits. The location is looked up from the anonymised address. |
|
|
786
|
+
| Keep security events for | `securityLogRetentionDays` | 90 days | 1-730. A daily job (03:17 server time, one process per cluster) deletes older events. |
|
|
787
|
+
|
|
788
|
+
When an admin account is deleted, the plugin deletes the events of that admin (sign-ins, failures, activity). Where that admin had signed someone else out, the event stays with the other admin and only the actor reference is cleared. The same clean-up runs daily for accounts deleted while the plugin was not running.
|
|
789
|
+
|
|
790
|
+
### Legal notes (information, not legal advice)
|
|
791
|
+
|
|
792
|
+
These notes describe what the feature does so you can check it with your data protection officer; they are not legal advice.
|
|
793
|
+
|
|
794
|
+
- **GDPR.** Sign-in history with IP addresses is personal data of your admins. A typical basis is a legitimate interest in securing the admin panel (Art. 6(1)(f) GDPR) or, for employees, the national employment rules. Tell your admins about it in your privacy information (Art. 13), keep the retention as short as your security needs allow, and consider **Anonymise the last part of IP addresses**. An admin's events can be exported as CSV for an access request (Art. 15) and are deleted with the account.
|
|
795
|
+
- **Content Manager activity.** This records what each person works on and when. In Germany, a technical system that can monitor the behaviour or performance of employees is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist in other countries. That is why it is off by default; inform the people concerned and, where there is one, agree it with the works council before you turn it on. Check whether a data protection impact assessment (Art. 35 GDPR) is needed.
|
|
796
|
+
- **Third parties.** With the `auto` or `ipapi` location provider, IP addresses can be sent to ipapi.co. Use a local MaxMind database or turn off the IP location lookup to keep them on your server.
|
|
797
|
+
|
|
798
|
+
### Performance
|
|
799
|
+
|
|
800
|
+
Measured with `scripts/bench-admin-activity.cjs` (Strapi 5.63, SQLite, Node 22, Apple silicon, one process): 1,000 Content Manager requests per run (500 opens of 100 entries, 500 edits), three runs each, alternating.
|
|
801
|
+
|
|
802
|
+
| Content Manager activity | Mean | p50 | p95 | p99 | Events stored per run |
|
|
803
|
+
| ------------------------ | ------------ | ------------ | ------------ | ------------ | --------------------- |
|
|
804
|
+
| Off | 4.65-5.22 ms | 4.66-5.20 ms | 6.17-7.14 ms | 8.06-8.41 ms | 0 |
|
|
805
|
+
| On | 4.65-4.82 ms | 4.69-4.85 ms | 6.16-6.35 ms | 8.06-8.58 ms | 500-575 |
|
|
806
|
+
|
|
807
|
+
The difference is within the run-to-run noise: recording adds no measurable latency, because the request only pushes an object onto the queue.
|
|
808
|
+
|
|
731
809
|
## Running several instances (Railway replicas, pm2 cluster)
|
|
732
810
|
|
|
733
811
|
The plugin works with several Strapi processes that share one database, for example 2 Railway replicas with 4 pm2 cluster workers each (8 processes). No sticky sessions are needed (Railway does not offer them) and no extra infrastructure: the database is the single source of truth.
|
|
@@ -895,6 +973,7 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
895
973
|
| Admin lists | Only the visible page (25-100 rows) is loaded and enriched. Counts for the cards and the widget are cached 5 seconds per process, Analytics 30 seconds. `GET /my-sessions` returns at most 200. |
|
|
896
974
|
| Idle cleanup | Runs on one process per interval (job lease). In `legacy-support` mode, `cleanupUseDbDirect: true` ends idle sessions with a single SQL update instead of one Document Service call per session. |
|
|
897
975
|
| Old history | Retention deletes ended sessions older than `retentionDays` (90 by default) once a day, so the table does not grow without bound. |
|
|
976
|
+
| Security log | Events are queued in memory and written in batches about once a second; nothing on the request path waits for the database or a GeoIP lookup. Indexes on actor, target, event and time; a daily job deletes events older than the retention. |
|
|
898
977
|
|
|
899
978
|
---
|
|
900
979
|
|
|
@@ -913,7 +992,8 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
913
992
|
- **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.
|
|
914
993
|
- **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.
|
|
915
994
|
- **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.
|
|
916
|
-
- **Admin panel sessions.** The Admin panel view reads Strapi's own `admin::session` records (origin `admin`)
|
|
995
|
+
- **Admin panel sessions.** The Admin panel view reads Strapi's own `admin::session` records (origin `admin`). 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.
|
|
996
|
+
- **Admin activity and sign-in history.** The plugin's security log stores admin sign-ins with IP address and user agent (on by default; IP anonymisation and retention configurable) and, only when you turn it on, Content Manager activity. Only Super Admin sees it until another role gets `admin-activity.read`. Typed emails of failed sign-ins, passwords and request bodies are never stored. Details and legal notes: [Admin activity and sign-in history](#admin-activity-and-sign-in-history).
|
|
917
997
|
|
|
918
998
|
---
|
|
919
999
|
|
|
@@ -968,6 +1048,10 @@ Session history lives in the content-type tables `magic_sessions` and `magic_ses
|
|
|
968
1048
|
|
|
969
1049
|
## Migration and upgrading
|
|
970
1050
|
|
|
1051
|
+
### To the release with the security log (from 4.14.x)
|
|
1052
|
+
|
|
1053
|
+
Nothing to do. On the first start Strapi creates the table `magic_sessions_security_events` with its indexes, and the plugin starts recording admin sign-ins (with IP addresses) right away; Content Manager activity stays off until you turn it on. Existing routes, responses and settings are unchanged; the new routes and the permission **View admin activity** are additions, and only Super Admin has the permission at first. Behind a reverse proxy, check [Client IP address and reverse proxies](#client-ip-address-and-reverse-proxies) so the stored addresses are your users' and not your proxy's. To keep the previous behaviour (no sign-in history), turn off **Record admin sign-ins** in Configuration › Admin activity.
|
|
1054
|
+
|
|
971
1055
|
### Strapi older than 5.50
|
|
972
1056
|
|
|
973
1057
|
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:
|
|
@@ -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 { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, s as isCancelledRequest, 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-
|
|
10
|
+
import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, s as isCancelledRequest, 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-DUESEUaO.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;
|
|
@@ -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-
|
|
12
|
+
const index = require("./index-CgZiLcJ1.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);
|