strapi-plugin-magic-sessionmanager 4.22.0 → 4.23.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 +80 -0
- package/README.md +163 -119
- package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
- package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
- package/dist/admin/{Analytics-WbCUmkQQ.mjs → Analytics-DGAHD19E.mjs} +1 -1
- package/dist/admin/{Analytics-DeDLGiCe.js → Analytics-_WA68oHb.js} +1 -1
- package/dist/admin/{App-Bkv-W0Sv.js → App-CfhAQ17e.js} +304 -104
- package/dist/admin/{App-C4bihk2K.mjs → App-VB66H73A.mjs} +276 -76
- package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
- package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
- package/dist/admin/{OnlineUsersWidget-q0Z6nbbO.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CSvNe2rC.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
- package/dist/admin/{Settings-xokFI5LO.js → Settings-BBs2FDp7.js} +87 -266
- package/dist/admin/{Settings-avD0DbXP.mjs → Settings-CKDNGJhl.mjs} +79 -258
- package/dist/admin/{de-BQlEdBMr.mjs → de-CK-HuY41.mjs} +48 -7
- package/dist/admin/{de-HcJ19LKI.js → de-CSRQPn6F.js} +48 -7
- package/dist/admin/{en-DI-98CPM.js → en-DCtAgGEa.js} +48 -7
- package/dist/admin/{en-DzuXWL1W.mjs → en-KZ5ajaAR.mjs} +48 -7
- package/dist/admin/{es-BfyED9YI.mjs → es-B7k8taWV.mjs} +48 -7
- package/dist/admin/{es-Cm0Eklav.js → es-CKT00l4K.js} +48 -7
- package/dist/admin/{fr-C3nzszsI.js → fr-B2EdBFSb.js} +48 -7
- package/dist/admin/{fr-CzFNGWq0.mjs → fr-Q2gmYqCn.mjs} +48 -7
- package/dist/admin/{index-6zc5D8eb.mjs → index-BPbs1GyP.mjs} +386 -61
- package/dist/admin/{index-Dk5Jqe5U.js → index-Cho0XGZ1.js} +340 -15
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BPZ6chPT.js → pt-CcMUcqDy.js} +48 -7
- package/dist/admin/{pt-DmyQnGI_.mjs → pt-CmxZTaf2.mjs} +48 -7
- package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
- package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
- package/dist/server/index.js +1809 -400
- package/dist/server/index.mjs +1809 -400
- package/package.json +9 -4
- package/dist/admin/dashboardModel-BBNRgcEr.mjs +0 -170
- package/dist/admin/dashboardModel-D4389iIV.js +0 -169
package/README.md
CHANGED
|
@@ -61,20 +61,21 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
|
|
|
61
61
|
|
|
62
62
|
## Features
|
|
63
63
|
|
|
64
|
-
| Area | What you get
|
|
65
|
-
| ---------------------- |
|
|
66
|
-
| Overview | A sessions dashboard with Active, Idle and Ended counts, search, filters, CSV and JSON export, and a details dialog per session (device, browser, IP address, location, and a security score when a [risk data source](#risk-data-vpn-proxy-tor) is set up).
|
|
67
|
-
| Control | End one session, end all sessions of a user, delete a record, or block a user. Ended sessions are rejected on the next request with 401 and a reason header.
|
|
68
|
-
| Your users | Content API routes for "my sessions", "current session", log out, log out everywhere and log out other devices. Each user only ever sees their own sessions.
|
|
69
|
-
| Login protection | Temporary IP lockout after failed sign-ins, Content API rate limits, optional rejection of VPN, proxy or low-score sign-ins (needs a [risk data source](#risk-data-vpn-proxy-tor)), and country allow or block lists.
|
|
70
|
-
| Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off.
|
|
71
|
-
| Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack.
|
|
72
|
-
| Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage.
|
|
73
|
-
| 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.
|
|
74
|
-
| 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.
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
64
|
+
| Area | What you get |
|
|
65
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
66
|
+
| Overview | A sessions dashboard with Active, Idle and Ended counts, search, filters, CSV and JSON export, and a details dialog per session (device, browser, IP address, location, and a security score when a [risk data source](#risk-data-vpn-proxy-tor) is set up). |
|
|
67
|
+
| Control | End one session, end all sessions of a user, delete a record, or block a user. Ended sessions are rejected on the next request with 401 and a reason header. |
|
|
68
|
+
| Your users | Content API routes for "my sessions", "current session", log out, log out everywhere and log out other devices. Each user only ever sees their own sessions. |
|
|
69
|
+
| Login protection | Temporary IP lockout after failed sign-ins, Content API rate limits, optional rejection of VPN, proxy or low-score sign-ins (needs a [risk data source](#risk-data-vpn-proxy-tor)), and country allow or block lists. |
|
|
70
|
+
| Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
|
|
71
|
+
| Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
|
|
72
|
+
| Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
|
|
73
|
+
| 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. |
|
|
74
|
+
| 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. |
|
|
75
|
+
| Impersonation | Act as an app user for up to an hour, see which permissions an admin has, or sign in as another admin in a separate tab (read-only unless changes are allowed). Off by default, with a reason, a time limit and every step in the security log; see [Impersonation](#impersonation). |
|
|
76
|
+
| Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
|
|
77
|
+
| Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
|
|
78
|
+
| Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
|
|
78
79
|
|
|
79
80
|
---
|
|
80
81
|
|
|
@@ -387,7 +388,7 @@ Static defaults from `server/src/config/index.js`; admin units and ranges from t
|
|
|
387
388
|
| `strictSessionEnforcement` | `false` (Relaxed) | boolean | Sessions | Strict rejects tokens without a session record and requests where the check itself fails. Ended, expired and revoked sessions and blocked users are rejected in both modes. |
|
|
388
389
|
| `sessionCreationGraceMs` | `5000` | ms, 0 to 30000 (shown in seconds) | Sessions › Advanced | Window after sign-in in which a token is accepted while its record is being created. |
|
|
389
390
|
| `maxFailedLogins` | 5 | 0 to 100, 0 = off | Login protection | Temporary IP lockout threshold (failed sign-ins from one IP within 15 minutes). |
|
|
390
|
-
| `trustedProxies` |
|
|
391
|
+
| `trustedProxies` | empty | list of IP addresses or CIDR ranges | Login protection | Proxies that may name the client in `X-Forwarded-For` (4.22.1). Empty: Strapi's `server.proxy` settings decide. See [Client IP address](#client-ip-address). The former `true` is read as empty. Protected setting. |
|
|
391
392
|
| `blockSuspiciousSessions` | `false` | boolean | Login protection | Reject suspicious sign-ins. Needs a [risk data source](#risk-data-vpn-proxy-tor); without one it is shown off and disabled, and the saved value is kept. |
|
|
392
393
|
| `geoLookupFailureMode` | `'auto'` | auto, allow, block | Login protection | What happens when the location cannot be determined. |
|
|
393
394
|
| `enableGeofencing` | `false` | boolean | Login protection | Use country rules. |
|
|
@@ -406,14 +407,14 @@ Static defaults from `server/src/config/index.js`; admin units and ranges from t
|
|
|
406
407
|
|
|
407
408
|
### Environment variables
|
|
408
409
|
|
|
409
|
-
| Variable | Purpose
|
|
410
|
-
| -------------------------------------------- |
|
|
411
|
-
| `SESSION_ENCRYPTION_KEY` | Key for AES-256-GCM encryption of stored tokens. Required when `NODE_ENV=production` (startup fails without it). Keep it stable.
|
|
412
|
-
| `MAGIC_SESSIONMANAGER_GEOIP_DATABASE` | Path of a local MaxMind-compatible database (also `GEOIP_DATABASE_PATH`, `GEOLITE2_CITY_MMDB`, `GEOIP_CITY_DATABASE_PATH`, `GEOLITE2_COUNTRY_MMDB`, `GEOIP_COUNTRY_DATABASE_PATH`).
|
|
413
|
-
| `MAXMIND_ACCOUNT_ID`, `MAXMIND_LICENSE_KEY` | MaxMind credentials for database updates. They take precedence over credentials stored in the admin.
|
|
414
|
-
| `MAGIC_SESSIONMANAGER_ANONYMOUS_IP_DATABASE` | Path of a GeoIP2 Anonymous IP database (risk data). Default: `data/magic-sessionmanager/geoip/GeoIP2-Anonymous-IP.mmdb`.
|
|
415
|
-
| `MAGIC_SESSIONMANAGER_ASN_DATABASE` | Path of a GeoLite2 ASN database (hosting heuristic). Default: `data/magic-sessionmanager/geoip/GeoLite2-ASN.mmdb`.
|
|
416
|
-
| `MAXMIND_EDITION_ID` | Edition for the CLI updater, for example `GeoLite2-City`.
|
|
410
|
+
| Variable | Purpose |
|
|
411
|
+
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
412
|
+
| `SESSION_ENCRYPTION_KEY` | Key for AES-256-GCM encryption of stored tokens; use at least 32 bytes. Required when `NODE_ENV=production` (startup fails without it). Since 4.22.1 a shorter key logs an error at every start and a **Weak encryption key** event; the next major version will refuse to start with it. Keep it stable. |
|
|
413
|
+
| `MAGIC_SESSIONMANAGER_GEOIP_DATABASE` | Path of a local MaxMind-compatible database (also `GEOIP_DATABASE_PATH`, `GEOLITE2_CITY_MMDB`, `GEOIP_CITY_DATABASE_PATH`, `GEOLITE2_COUNTRY_MMDB`, `GEOIP_COUNTRY_DATABASE_PATH`). |
|
|
414
|
+
| `MAXMIND_ACCOUNT_ID`, `MAXMIND_LICENSE_KEY` | MaxMind credentials for database updates. They take precedence over credentials stored in the admin. |
|
|
415
|
+
| `MAGIC_SESSIONMANAGER_ANONYMOUS_IP_DATABASE` | Path of a GeoIP2 Anonymous IP database (risk data). Default: `data/magic-sessionmanager/geoip/GeoIP2-Anonymous-IP.mmdb`. |
|
|
416
|
+
| `MAGIC_SESSIONMANAGER_ASN_DATABASE` | Path of a GeoLite2 ASN database (hosting heuristic). Default: `data/magic-sessionmanager/geoip/GeoLite2-ASN.mmdb`. |
|
|
417
|
+
| `MAXMIND_EDITION_ID` | Edition for the CLI updater, for example `GeoLite2-City`. |
|
|
417
418
|
|
|
418
419
|
---
|
|
419
420
|
|
|
@@ -517,11 +518,20 @@ Requests with an ended session get **401** with the header `X-Session-Terminated
|
|
|
517
518
|
### Lockout, trusted addresses and Locked now
|
|
518
519
|
|
|
519
520
|
- **Per IP** (`maxFailedLogins`, default 5) and **per account** (`maxFailedLoginsPerAccount`, default 0 = off). The account counter uses a SHA-256 hash of the lower-cased identifier (`identifier` of `/auth/local`, `email` of the Magic Link routes); the typed identifier is never stored. An unknown account is counted and answered exactly like an existing one, so the response does not reveal which accounts exist.
|
|
520
|
-
-
|
|
521
|
+
- **What counts (4.22.1).** Only a wrong identifier or password counts, on every spelling of `POST /api/auth/local` (`/api/auth/local/`, `/API/auth/local`, …) and the GraphQL `login` mutation: the check runs inside Users & Permissions' `auth.callback`, which all of them call. A sign-in refused by another rule (session limit, country rules, a blocked or unconfirmed account) is not a failed guess. A successful sign-in clears the account counter, never the address counter, so signing in to an own account does not reset an address. IPv6 addresses count per /64.
|
|
522
|
+
- Anyone who knows an account name can lock that account for others. Since 4.22.1 the owner still signs in from a trusted address or from a known device (a device id the app sent with an earlier successful sign-in of that account). Keep the account threshold higher than the IP threshold; admins can lift a lock at once.
|
|
521
523
|
- **Window and duration**: `lockoutWindowMinutes` (1-1440) and `lockoutDurationMinutes` (1-10080). When a lock ends, the failures that caused it no longer count.
|
|
522
|
-
- **Trusted addresses** (`lockoutTrustedAddresses`, up to 100 IPs or CIDR ranges such as `192.0.2.0/24` or `2001:db8::/32`) are never locked by IP
|
|
524
|
+
- **Trusted addresses** (`lockoutTrustedAddresses`, up to 100 IPs or CIDR ranges such as `192.0.2.0/24` or `2001:db8::/32`) are never counted or locked, by IP or (since 4.22.1) by account. Use it for an office NAT or a backend that signs in for many users.
|
|
523
525
|
- **Locked now** (same tab) lists every active lock: IP addresses as the security log stores them (full, shortened or hidden) and accounts with their user. **Unlock** needs the permission **Unlock locked sign-ins** and is recorded with the admin who did it.
|
|
524
|
-
- **Lockout email** (`lockoutNotifyUser`, off by default) tells the account owner about an account lock, through Strapi's email plugin (Magic Mail delivers it when installed). The text is the **Account locked** template under Alerts › Email templates (`{{user.email}}`, `{{user.username}}`, `{{lock.minutes}}`, `{{lock.until}}`).
|
|
526
|
+
- **Lockout email** (`lockoutNotifyUser`, off by default) tells the account owner about an account lock, through Strapi's email plugin (Magic Mail delivers it when installed), at most once per account per window (the longer of window and lock duration). The text is the **Account locked** template under Alerts › Email templates (`{{user.email}}`, `{{user.username}}`, `{{lock.minutes}}`, `{{lock.until}}`).
|
|
527
|
+
|
|
528
|
+
### Client IP address
|
|
529
|
+
|
|
530
|
+
Every IP rule (lockout, rate limits, location rules) and every stored address uses one client address (4.22.1):
|
|
531
|
+
|
|
532
|
+
- **Default (`trustedProxies` empty):** Strapi's `ctx.request.ip`. Koa takes it from the socket, or, with `server.proxy.koa: true`, from `server.proxy.ipHeader` (default `X-Forwarded-For`) limited to the last `server.proxy.maxIpsCount` entries. Set `maxIpsCount` to the number of proxies in front of Strapi (Strapi 5.52+); see [the example](#client-ip-address-and-reverse-proxies). The plugin reads no proxy header itself, so `CF-Connecting-IP`, `True-Client-IP`, `X-Real-IP` or a left-most `X-Forwarded-For` entry sent by a client change nothing.
|
|
533
|
+
- **`trustedProxies`: a list of your proxies' addresses or CIDR ranges** (up to 50, Login protection › Client IP address). A request whose TCP peer is on the list uses the right-most `X-Forwarded-For` entry that is not on the list; a request from any other peer uses the peer's address, even when Koa trusts proxy headers. Use it when the proxy addresses are known but the number of hops varies.
|
|
534
|
+
- Up to 4.22 `trustedProxies: true` made the plugin read client-set headers. A stored `true` is changed to an empty list at start-up, a configured `true` is read as empty, and both log a warning.
|
|
525
535
|
|
|
526
536
|
### Concurrent session limit
|
|
527
537
|
|
|
@@ -557,7 +567,7 @@ Configuration › Alerts. Both kinds are sent only when location data is availab
|
|
|
557
567
|
|
|
558
568
|
- **Device, without fingerprinting.** Browser family, operating system family and device type from the User-Agent header, plus the optional `deviceId` your app sends in the sign-in body (Users & Permissions uses the same field for its sessions). No cookie is set and nothing else is read. The session stores `deviceKey`, an HMAC-SHA256 of these values with a key derived from `SESSION_ENCRYPTION_KEY`, so it cannot be linked to a device outside your installation. A sign-in is from a **new device** when none of the user's last 50 sessions has the same key; the first sign-in of a user is never new. Sessions created before 4.17 have no key and are compared by browser and system family.
|
|
559
569
|
- **Impossible travel** (Login protection › Impossible travel, off). The great-circle distance between this sign-in and the user's previous sign-in with a location, divided by the time between them. Flagged when the distance is at least `impossibleTravelMinDistanceKm` (500) and the speed is above `impossibleTravelSpeedKmh` (1000). Needs a location database with cities (coordinates); while the feature is on, locations are stored rounded to 0.1 degree (about 11 km). VPNs and mobile networks cause false alarms, so the default action only records and alerts. **Require a new sign-in** ends every session of the user and answers `401` with `error.details.code: "REAUTHENTICATION_REQUIRED"`; signing in again from the new place then works.
|
|
560
|
-
- **"This wasn't me"**: the link opens `GET /api/magic-sessionmanager/not-me
|
|
570
|
+
- **"This wasn't me"**: the link opens `GET /api/magic-sessionmanager/not-me#token=…`, a confirmation page in the user's browser language (en, de, fr, es, pt) that changes nothing; **Sign out that device** or **Sign out everywhere** posts to the same path. Since 4.22.1 the token is in the URL fragment, which browsers never send to the server, so it does not appear in access logs; a script allowed by its CSP hash copies it into the form. Links with `?token=` from earlier emails still work until they expire: if your proxy or Strapi logs query strings, redact `token=` there. The token is signed (HMAC-SHA256 with its own derived key), expires after 72 hours and works once, also across processes. The link is built from `server.url`; without an absolute http(s) URL the email has no link. Both routes are public on purpose and rate-limited per address.
|
|
561
571
|
|
|
562
572
|
### Signed webhook
|
|
563
573
|
|
|
@@ -588,7 +598,7 @@ function verifyMagicSignature(secret, rawBody, header, toleranceSeconds = 300) {
|
|
|
588
598
|
}
|
|
589
599
|
```
|
|
590
600
|
|
|
591
|
-
Use the raw request body (before JSON parsing). The URL and the secret are write-only: after saving, the admin panel only shows that they are set (the URL with its host, `https://hooks.example.com/…`); the secret is stored encrypted. Over the API, `GET /settings` returns `hasGenericWebhook`, `genericWebhookHint` and `hasGenericWebhookSecret` instead of the values; a `PUT` without `genericWebhookUrl` / `genericWebhookSecret` keeps the stored value, an empty string removes it. Changing the signed webhook, the event selection and **Send test** need **Change protected settings**. The server refuses URLs that are not https or
|
|
601
|
+
Use the raw request body (before JSON parsing). The URL and the secret are write-only: after saving, the admin panel only shows that they are set (the URL with its host, `https://hooks.example.com/…`); the secret is stored encrypted. Over the API, `GET /settings` returns `hasGenericWebhook`, `genericWebhookHint` and `hasGenericWebhookSecret` instead of the values; a `PUT` without `genericWebhookUrl` / `genericWebhookSecret` keeps the stored value, an empty string removes it. Changing the signed webhook, the event selection and **Send test** need **Change protected settings**. The server refuses URLs that are not https, contain credentials or (since 4.22.1) name a non-public IP address, and checks before every delivery that **every** address the host resolves to is public (no loopback, private, link-local including `169.254.169.254`, CGNAT, multicast, reserved, documentation, unique-local, IPv4-compatible or IPv4-translated IPv6 address); it then connects to the checked address, does not follow redirects, times out after 5 seconds without data or 10 seconds in total, and reads at most 64 KB of the answer. A new URL is saved only together with the secret (4.22.1), so the stored secret never signs events for another host. Network errors, timeouts, 429 and 5xx are retried after 2 and 10 seconds. **Send test** sends one `test` event and shows the result.
|
|
592
602
|
|
|
593
603
|
Example email provider configuration:
|
|
594
604
|
|
|
@@ -619,18 +629,18 @@ export default ({ env }) => ({
|
|
|
619
629
|
|
|
620
630
|
Prefix `/api/magic-sessionmanager`. Every route requires a Users & Permissions JWT (`Authorization: Bearer <JWT>`), works on the caller's **own** sessions only and is rate-limited (writes 10, reads 120 requests per minute by default; 429 with `Retry-After`).
|
|
621
631
|
|
|
622
|
-
| Method | Path | Purpose | Response
|
|
623
|
-
| --------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
624
|
-
| GET | `/my-sessions` | Own sessions (up to 200), current session first | `{ data: [...], meta: { count, active, hasMore, limit } }`
|
|
625
|
-
| GET | `/current-session` | The session of the current token | `{ data: {..., isCurrentSession: true } }`; 404 when none
|
|
626
|
-
| GET | `/user/:userId/sessions` | Sessions of a user; only your own `userId` | 403 for another user
|
|
627
|
-
| POST | `/logout` | End the current session (reason `logout`) | `{ message, terminated }`
|
|
628
|
-
| POST | `/logout-all` | End all own sessions (reason `logout`) | `{ message, terminatedCount }`
|
|
629
|
-
| POST | `/logout-others` | End all own sessions except the current one | `{ message, terminatedCount, currentSessionPreserved }`
|
|
630
|
-
| DELETE | `/my-sessions/:sessionId` | End one own session that is not the current one (reason `manual`) | `{ message, success, alreadyTerminated }`; 400 for the current session, 404 for unknown or foreign IDs
|
|
631
|
-
| GET | `/my-data` | Own sessions and security events as a JSON download (GDPR Art. 15); 3 per hour | `{ exportedAt, user, sessions, securityEvents }` with `Content-Disposition: attachment`; no tokens, hashes or device keys |
|
|
632
|
-
| GET, POST | `/not-me` | **Public** (no JWT): the "This wasn't me" link of the security emails; GET shows a confirmation, POST `{ token, scope: 'session' \| 'all' }` ends sessions | HTML page, or `{ data: { ended, scope } }` with `Accept: application/json`; 410 when the link is invalid, expired or used
|
|
633
|
-
| POST | `/impersonation/exchange` | **Public** (no JWT): exchanges the one-time code of the [impersonation](#impersonation) hand-off, `{ code }`; 10 per minute per IP | `{ data: { jwt, refreshToken?, expiresAt, user, impersonation } }`; 400 for any unusable code
|
|
632
|
+
| Method | Path | Purpose | Response |
|
|
633
|
+
| --------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
634
|
+
| GET | `/my-sessions` | Own sessions (up to 200), current session first | `{ data: [...], meta: { count, active, hasMore, limit } }` |
|
|
635
|
+
| GET | `/current-session` | The session of the current token | `{ data: {..., isCurrentSession: true } }`; 404 when none |
|
|
636
|
+
| GET | `/user/:userId/sessions` | Sessions of a user; only your own `userId` | 403 for another user |
|
|
637
|
+
| POST | `/logout` | End the current session (reason `logout`) | `{ message, terminated }` |
|
|
638
|
+
| POST | `/logout-all` | End all own sessions (reason `logout`) | `{ message, terminatedCount }` |
|
|
639
|
+
| POST | `/logout-others` | End all own sessions except the current one | `{ message, terminatedCount, currentSessionPreserved }` |
|
|
640
|
+
| DELETE | `/my-sessions/:sessionId` | End one own session that is not the current one (reason `manual`) | `{ message, success, alreadyTerminated }`; 400 for the current session, 404 for unknown or foreign IDs |
|
|
641
|
+
| GET | `/my-data` | Own sessions and security events as a JSON download (GDPR Art. 15); 3 per hour | `{ exportedAt, user, sessions, securityEvents }` with `Content-Disposition: attachment`; no tokens, hashes or device keys; an impersonation shows only "An administrator opened your account", the time and the duration (4.22.1), never the admin or the reason |
|
|
642
|
+
| GET, POST | `/not-me` | **Public** (no JWT): the "This wasn't me" link of the security emails; GET shows a confirmation, POST `{ token, scope: 'session' \| 'all' }` ends sessions | HTML page, or `{ data: { ended, scope } }` with `Accept: application/json`; 410 when the link is invalid, expired or used |
|
|
643
|
+
| POST | `/impersonation/exchange` | **Public** (no JWT): exchanges the one-time code of the [impersonation](#impersonation) hand-off, `{ code }`; 10 per minute per IP | `{ data: { jwt, refreshToken?, expiresAt, user, impersonation } }`; 400 for any unusable code |
|
|
634
644
|
|
|
635
645
|
`POST /api/auth/logout` also ends the current session; the plugin mounts it when Users & Permissions does not provide it.
|
|
636
646
|
|
|
@@ -759,62 +769,67 @@ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authe
|
|
|
759
769
|
|
|
760
770
|
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):
|
|
761
771
|
|
|
762
|
-
| Permission
|
|
763
|
-
|
|
|
764
|
-
| `plugin::magic-sessionmanager.admin-sessions.read`
|
|
765
|
-
| `plugin::magic-sessionmanager.admin-sessions.revoke`
|
|
766
|
-
| `plugin::magic-sessionmanager.admin-activity.read`
|
|
767
|
-
| `plugin::magic-sessionmanager.user-activity.read`
|
|
768
|
-
| `plugin::magic-sessionmanager.settings.update`
|
|
769
|
-
| `plugin::magic-sessionmanager.lockouts.unlock`
|
|
770
|
-
| `plugin::magic-sessionmanager.impersonate.users`
|
|
771
|
-
| `plugin::magic-sessionmanager.impersonate.admins`
|
|
772
|
+
| Permission | Name in the role editor | Allows |
|
|
773
|
+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
774
|
+
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
|
|
775
|
+
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
|
|
776
|
+
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent security activity and the Security activity page, CSV exports and changing the Admin activity settings (also needs read) |
|
|
777
|
+
| `plugin::magic-sessionmanager.user-activity.read` | View app-user security activity | **Security activity** on the App users tab and in the user's Sessions panel, the full page and its CSV export (also needs `access`, not `admin-sessions.read`); see [Security activity of app users](#security-activity-of-app-users) |
|
|
778
|
+
| `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log, sign-in policies) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, the sign-in and session policies (lockout, trusted addresses, session limit, password-change sign-out, role rules), the signed webhook and its **Send test**, the event selection, impossible travel and shortened session IPs, and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
|
|
779
|
+
| `plugin::magic-sessionmanager.lockouts.unlock` | Unlock locked sign-ins | **Unlock** in Login protection › Locked now (also needs `access`) |
|
|
780
|
+
| `plugin::magic-sessionmanager.impersonate.users` | Impersonate app users | Starting, listing and ending impersonations of app users (also needs `access` and the **Allow impersonation** switch); see [Impersonation](#impersonation). Since 4.20 |
|
|
781
|
+
| `plugin::magic-sessionmanager.impersonate.admins` | View admin permissions (read-only preview) | **View permissions** in the Admin panel view, and listing and ending such previews (also needs `access` and the switch); see [View permissions](#view-permissions-of-an-admin-read-only-preview). Since 4.20 |
|
|
782
|
+
| `plugin::magic-sessionmanager.impersonate.admins.sign-in` | Sign in as another admin | **Sign in as** in the Admin panel view: a real admin session of another admin in a separate tab, read-only unless changes are allowed; listing and ending them (also needs `access` and the switch); see [Sign in as another admin](#sign-in-as-another-admin). Since 4.23 |
|
|
772
783
|
|
|
773
784
|
**What the admin panel view shows about other admins (4.17).** Names, emails and roles of admins are Strapi's own user data. The Admin panel view and the sign-in history return them only to roles that may also read them in Settings › Users: email and name need Strapi's **Read** permission on Users (`admin::users.read`), role names need it or **Read** on Roles (`admin::roles.read`). Without them the list shows "Admin #12", "Email hidden" and "Hidden" (roles), and the search matches the admin id only. Every admin always sees their own row. Grant `admin::users.read` to roles that should keep seeing names and emails.
|
|
774
785
|
|
|
775
|
-
**Protected settings (4.17).** `PUT /settings` still needs only `access`, so roles that change the session, login-protection, alert-email and retention options keep working. Changing a protected key needs **Change protected settings** as well, else 403 with `error.details.reason: "settings-update-permission"`: `enableGeolocation`, `geoIpProvider`, `geoLookupFailureMode`, `geoIpDatabasePath`, `enableWebhooks`, `discordWebhookUrl`, `slackWebhookUrl`, every security log key (those also keep needing **View admin activity**, reason `admin-activity-permission`) and the sign-in and session policy keys (`maxFailedLoginsPerAccount`, `lockoutWindowMinutes`, `lockoutDurationMinutes`, `lockoutTrustedAddresses`, `lockoutNotifyUser`, `recordUserSignInEvents`, `maxSessionsPerUser`, `sessionLimitPolicy`, `endOtherSessionsOnPasswordChange`, `roleRules`), and the detection and integration keys (`impossibleTravelEnabled`, `impossibleTravelSpeedKmh`, `impossibleTravelMinDistanceKm`, `impossibleTravelAction`, `webhookEvents`, `genericWebhookEnabled`, `genericWebhookUrl`, `genericWebhookSecret`, `sessionIpAnonymize`), and `impersonationEnabled` (4.20). The new-device and impossible-travel email switches stay with `access`, like the other alert emails. Sending a protected key back with its stored value is not a change, so these roles can still save the whole form. The admin UI shows these controls read-only for them.
|
|
776
|
-
|
|
777
|
-
| Method | Path | Admin UI action
|
|
778
|
-
| -------- | -------------------------------------------------------------- |
|
|
779
|
-
| GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below
|
|
780
|
-
| GET | `/sessions/active` | Active sessions only; same paging parameters
|
|
781
|
-
| GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process
|
|
782
|
-
| GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise)
|
|
783
|
-
| POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute
|
|
784
|
-
| GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds
|
|
785
|
-
| GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor`
|
|
786
|
-
| GET | `/user/:userId/sessions` | Sessions panel
|
|
787
|
-
| POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays)
|
|
788
|
-
| DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends)
|
|
789
|
-
| POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check)
|
|
790
|
-
| POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`)
|
|
791
|
-
| POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user**
|
|
792
|
-
| GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`)
|
|
793
|
-
| GET | `/geolocation/:ipAddress` | **Look up location**
|
|
794
|
-
| GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`)
|
|
795
|
-
| PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials
|
|
796
|
-
| POST | `/geoip/update` | Update database / Force download. Body `{ "force"?: boolean, "database"?: "location" \| "anonymous-ip" \| "asn" }` (default `location`; anything else is 400). A 401/403 from MaxMind answers 502 "MaxMind refused the download…"
|
|
797
|
-
| GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input). Webhook URLs are never returned: `hasDiscordWebhook`, `hasSlackWebhook` and a hint (`https://discord.com/…`); see below
|
|
798
|
-
| POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging`
|
|
799
|
-
| GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email; the admin id only without `admin::users.read`), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read`
|
|
800
|
-
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read`
|
|
801
|
-
| POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute
|
|
802
|
-
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute
|
|
803
|
-
| GET | `/admin-activity/sign-ins` | **Sign-in history**, **Recent security activity** and the **Security activity** page: `adminId`, `event` (`all`, `succeeded`, `failed`, `signed-out`, `changes`), `from`, `to` (ISO dates), `page`, `pageSize` (1-100); needs `admin-activity.read`
|
|
804
|
-
| GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor`
|
|
805
|
-
| 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`
|
|
806
|
-
| GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor`
|
|
807
|
-
| GET | `/user-activity` | **Security activity of app users**: `event` (`all`, `failed`, `lockouts`, `suspicious`, `sessions`, `privacy`, `impersonation`), `userId` (documentId), `from`, `to`, `page`, `pageSize` (1-100); needs `user-activity.read`
|
|
808
|
-
| GET | `/user-activity/export` | CSV export batches of 500 rows; same filters plus `cursor`; the first batch of every export is recorded in the security log
|
|
809
|
-
| GET | `/lockouts` | **Locked now**: `{ data: [{ id, kind: 'ip' \| 'account', ip, user, failures, lockedAt, until }] }`; read rate limit
|
|
810
|
-
| POST | `/lockouts/unlock` | **Unlock**: body `{ id }` from the list; needs `lockouts.unlock`; 404 when the lock already ended; 10 per minute
|
|
811
|
-
| GET | `/roles` | Users & Permissions roles (without Public) for **Different rules for some roles**
|
|
812
|
-
| GET | `/impersonation/status` | `{ data: { enabled, handoff: 'frontend' \| 'token', frontendOrigin, durations, mode } }`
|
|
813
|
-
| POST | `/impersonation/users/:userId` | **Start impersonation**: body `{ reason, durationMinutes: 15 \| 30 \| 60, notifyUser? }`; needs `impersonate.users`; signed-in admins only; 201 `{ data: { impersonation, handoff } }` (`Cache-Control: no-store`); 10 per 10 minutes
|
|
814
|
-
| POST | `/impersonation/admins/:adminId/preview` | **View
|
|
815
|
-
| GET | `/impersonation/previews/:id` | The running preview, for the admin who started it; 404 otherwise or once it ended
|
|
816
|
-
|
|
|
817
|
-
| POST | `/impersonation
|
|
786
|
+
**Protected settings (4.17).** `PUT /settings` still needs only `access`, so roles that change the session, login-protection, alert-email and retention options keep working. Changing a protected key needs **Change protected settings** as well, else 403 with `error.details.reason: "settings-update-permission"`: `enableGeolocation`, `geoIpProvider`, `geoLookupFailureMode`, `geoIpDatabasePath`, `enableWebhooks`, `discordWebhookUrl`, `slackWebhookUrl`, every security log key (those also keep needing **View admin activity**, reason `admin-activity-permission`) and the sign-in and session policy keys (`maxFailedLoginsPerAccount`, `lockoutWindowMinutes`, `lockoutDurationMinutes`, `lockoutTrustedAddresses`, `lockoutNotifyUser`, `recordUserSignInEvents`, `maxSessionsPerUser`, `sessionLimitPolicy`, `endOtherSessionsOnPasswordChange`, `roleRules`), and the detection and integration keys (`impossibleTravelEnabled`, `impossibleTravelSpeedKmh`, `impossibleTravelMinDistanceKm`, `impossibleTravelAction`, `webhookEvents`, `genericWebhookEnabled`, `genericWebhookUrl`, `genericWebhookSecret`, `sessionIpAnonymize`), and `impersonationEnabled` (4.20), and since 4.22.1 `trustedProxies`, `maxFailedLogins` (the IP threshold) and `emailTemplates` (the alert texts go to app users from your address). The new-device and impossible-travel email switches stay with `access`, like the other alert emails. Sending a protected key back with its stored value is not a change, so these roles can still save the whole form. The admin UI shows these controls read-only for them.
|
|
787
|
+
|
|
788
|
+
| Method | Path | Admin UI action |
|
|
789
|
+
| -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
790
|
+
| GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
|
|
791
|
+
| GET | `/sessions/active` | Active sessions only; same paging parameters |
|
|
792
|
+
| GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
|
|
793
|
+
| GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
|
|
794
|
+
| POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
|
|
795
|
+
| GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
|
|
796
|
+
| GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
|
|
797
|
+
| GET | `/user/:userId/sessions` | Sessions panel |
|
|
798
|
+
| POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
|
|
799
|
+
| DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
|
|
800
|
+
| POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
|
|
801
|
+
| POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
|
|
802
|
+
| POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
|
|
803
|
+
| GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
|
|
804
|
+
| GET | `/geolocation/:ipAddress` | **Look up location** |
|
|
805
|
+
| GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`) |
|
|
806
|
+
| PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
|
|
807
|
+
| POST | `/geoip/update` | Update database / Force download. Body `{ "force"?: boolean, "database"?: "location" \| "anonymous-ip" \| "asn" }` (default `location`; anything else is 400). A 401/403 from MaxMind answers 502 "MaxMind refused the download…" |
|
|
808
|
+
| GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input). Webhook URLs are never returned: `hasDiscordWebhook`, `hasSlackWebhook` and a hint (`https://discord.com/…`); see below |
|
|
809
|
+
| POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
|
|
810
|
+
| GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email; the admin id only without `admin::users.read`), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
|
|
811
|
+
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
|
|
812
|
+
| POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
813
|
+
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
814
|
+
| GET | `/admin-activity/sign-ins` | **Sign-in history**, **Recent security activity** and the **Security activity** page: `adminId`, `event` (`all`, `succeeded`, `failed`, `signed-out`, `changes`), `from`, `to` (ISO dates), `page`, `pageSize` (1-100); needs `admin-activity.read` |
|
|
815
|
+
| GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor` |
|
|
816
|
+
| 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` |
|
|
817
|
+
| GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor` |
|
|
818
|
+
| GET | `/user-activity` | **Security activity of app users**: `event` (`all`, `failed`, `lockouts`, `suspicious`, `sessions`, `privacy`, `impersonation`), `userId` (documentId), `from`, `to`, `page`, `pageSize` (1-100); needs `user-activity.read` |
|
|
819
|
+
| GET | `/user-activity/export` | CSV export batches of 500 rows; same filters plus `cursor`; the first batch of every export is recorded in the security log |
|
|
820
|
+
| GET | `/lockouts` | **Locked now**: `{ data: [{ id, kind: 'ip' \| 'account', ip, user, failures, lockedAt, until }] }`; read rate limit |
|
|
821
|
+
| POST | `/lockouts/unlock` | **Unlock**: body `{ id }` from the list; needs `lockouts.unlock`; 404 when the lock already ended; 10 per minute |
|
|
822
|
+
| GET | `/roles` | Users & Permissions roles (without Public) for **Different rules for some roles** |
|
|
823
|
+
| GET | `/impersonation/status` | `{ data: { enabled, handoff: 'frontend' \| 'token', frontendOrigin, durations, mode } }` |
|
|
824
|
+
| POST | `/impersonation/users/:userId` | **Start impersonation**: body `{ reason, durationMinutes: 15 \| 30 \| 60, notifyUser? }`; needs `impersonate.users`; signed-in admins only; 201 `{ data: { impersonation, handoff } }` (`Cache-Control: no-store`); 10 per 10 minutes |
|
|
825
|
+
| POST | `/impersonation/admins/:adminId/preview` | **View permissions**: body `{ reason, durationMinutes: 15 \| 30 }`; needs `impersonate.admins`; signed-in admins only; 201 `{ data: { impersonation, preview: { admin, contentTypes, otherPermissions } } }`; 403 `self`, `super-admin`, `not-subset`; 10 per 10 minutes |
|
|
826
|
+
| GET | `/impersonation/previews/:id` | The running preview, for the admin who started it; 404 otherwise or once it ended |
|
|
827
|
+
| POST | `/impersonation/admins/:adminId/sign-in` | **Sign in as** (4.23): body `{ reason, durationMinutes: 15 \| 30, allowChanges?: boolean }`; needs `impersonate.admins.sign-in`; signed-in admins only; 201 `{ data: { impersonation, handoff: { type: 'admin-tab', path, cookieName, code, codeExpiresAt } } }`; 403 `disabled`, `unsupported`, `nested`, `self`, `super-admin`, `inactive`, `not-subset`, `already-active`, `api-token`; 10 per 10 minutes |
|
|
828
|
+
| POST | `/admin-impersonation/exchange` | The new tab exchanges the one-time code with the starting admin's own token: `{ data: { token, expiresAt, cookieName, impersonation } }`; needs `impersonate.admins.sign-in`; any unusable code 400; 10 per minute |
|
|
829
|
+
| GET | `/admin-impersonation/self` | The impersonation of the calling tab (its own token only, recognised by the guard; the target may lack plugin access): `{ data: { id, expiresAt, allowChanges } }`; 401 for anyone else |
|
|
830
|
+
| POST | `/admin-impersonation/self/end` | Ends the impersonation of the calling tab (its own session only): `{ data: { ended } }`; 401 for anyone else |
|
|
831
|
+
| GET | `/impersonation/active` | **Active impersonations**: `{ data: [{ id, targetType, targetId, targetLabel, actorId, actorLabel, startedByYou, reason, durationMinutes, handoff, allowChanges, credentialIssued, startedAt, expiresAt, state }] }`; app users with `impersonate.users`, admin previews and sign-ins with `impersonate.admins` or `impersonate.admins.sign-in` |
|
|
832
|
+
| POST | `/impersonation/:id/end` | **End impersonation**: `{ data: { ended } }`; needs the impersonate permission of its kind; 404 for unknown ids |
|
|
818
833
|
|
|
819
834
|
**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.
|
|
820
835
|
|
|
@@ -861,11 +876,11 @@ Red marks a security signal (failed, refused, locked, impossible travel, "This w
|
|
|
861
876
|
|
|
862
877
|
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:
|
|
863
878
|
|
|
864
|
-
| Recorded | Events
|
|
865
|
-
| ------------------------------------ |
|
|
866
|
-
| **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)
|
|
867
|
-
| **Content Manager activity** | `admin.content.view` (opening an entry), `.create`, `.update`, `.publish`, `.unpublish`, `.discard`, `.delete`, `.clone`, with content type, document id and locale
|
|
868
|
-
| **Changes to the log itself** (4.17) | `settings.updated` (who changed which settings keys, never the values), `security-log.retention.purged` (how many events the daily job deleted), `security-log.read` (a read of the history with an admin API token, once per token and list per 5 minutes) | Always |
|
|
879
|
+
| Recorded | Events | Default |
|
|
880
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
881
|
+
| **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 |
|
|
882
|
+
| **Content Manager activity** | `admin.content.view` (opening an entry), `.create`, `.update`, `.publish`, `.unpublish`, `.discard`, `.delete`, `.clone`, with content type, document id and locale | **Off** |
|
|
883
|
+
| **Changes to the log itself** (4.17) | `settings.updated` (who changed which settings keys, never the values), `security-log.retention.purged` (how many events the daily job deleted), `security-log.read` (a read of the history with an admin API token, once per token and list per 5 minutes), `config.encryption-key.weak` (4.22.1: `SESSION_ENCRYPTION_KEY` is shorter than 32 bytes, once per key) | Always |
|
|
869
884
|
|
|
870
885
|
The changes to the log itself belong to no single admin's history: they are listed on the **Security activity** page (filter **Settings and log access**, also part of **All events**) and in **Recent security activity**, never in the Sign-in history tab of one admin.
|
|
871
886
|
|
|
@@ -1012,7 +1027,8 @@ The code is 32 random bytes, stored only as a SHA-256 hash, valid for 60 seconds
|
|
|
1012
1027
|
- every `/api/auth/*` route except `POST /api/auth/refresh` and `GET /api/auth/sessions`: password change, reset and forgot-password, email confirmation, sign-in, registration, provider sign-in, logout and ending sessions; also `/api/connect/*`;
|
|
1013
1028
|
- `POST`, `PUT` and `DELETE` on `/api/users` and `/api/users/:id` (email, password and account changes, account deletion);
|
|
1014
1029
|
- the plugin's own routes except the three reads (`/my-sessions`, `/current-session`, `/user/:userId/sessions`): logout, ending own sessions, the data export `GET /my-data`, "This wasn't me" links and the exchange itself (no nesting);
|
|
1015
|
-
- Magic Link and passwordless sign-in routes
|
|
1030
|
+
- Magic Link and passwordless sign-in routes;
|
|
1031
|
+
- **every GraphQL mutation** (4.22.1), refused inside Apollo after it has resolved the operation, so aliases, fragments, persisted queries and batched requests are covered: 403, `errors[0].extensions.code` `FORBIDDEN`, `extensions.error.details.reason` `impersonation-mutation`. GraphQL queries work as for the user. The plugin adds this Apollo plugin to `plugin::graphql.apolloServer.plugins` at start-up, next to yours. Up to 4.22 GraphQL mutations were not restricted.
|
|
1016
1032
|
|
|
1017
1033
|
Everything else of your API works as for the user. An ended or expired impersonation gets 401 with `impersonation-ended` or `impersonation-expired`.
|
|
1018
1034
|
|
|
@@ -1059,25 +1075,52 @@ body[data-impersonating]::before {
|
|
|
1059
1075
|
- What: a credential of the user's own permissions, never more; credential, account and session changes are refused.
|
|
1060
1076
|
- How long: at most 60 minutes, enforced server-side; codes 60 seconds and single use.
|
|
1061
1077
|
- Accountability: reason, duration, actor and target in the security log; optional email to the user.
|
|
1062
|
-
- Not covered: requests your own routes make on the user's behalf are not restricted unless they match the list above; review custom routes that change credentials or emails.
|
|
1078
|
+
- Not covered: requests your own routes make on the user's behalf are not restricted unless they match the list above; review custom routes that change credentials or emails. For admins of the admin panel see [View permissions](#view-permissions-of-an-admin-read-only-preview) and [Sign in as another admin](#sign-in-as-another-admin).
|
|
1063
1079
|
|
|
1064
|
-
### View
|
|
1080
|
+
### View permissions of an admin (read-only preview)
|
|
1065
1081
|
|
|
1066
|
-
**What it does.** In Session Manager › Admin panel, the row action **View
|
|
1082
|
+
**What it does.** In Session Manager › Admin panel, the row action **View permissions** (the person icon next to **View sessions** and **Sign out everywhere**; on narrow screens a **View permissions** button; called **View as** up to 4.22) opens a dialog that asks for a reason and a duration (15 or 30 minutes) and then shows which content types that admin can open and with which actions (Create, Read, Update, Delete, Publish; "restricted" when fields, locales or conditions limit them), their roles and their other permissions, computed on the server from their role permissions with Strapi's permission service. A banner on top reads "You are viewing as … · read-only · ends in mm:ss · End". Nobody is signed in and nothing can be changed: the preview creates no session and no token, so read-only holds by construction. Closing the dialog, **End**, the end of the duration or turning the switch off ends it; it also shows in **Active impersonations** while it runs. Needs **View admin permissions (read-only preview)** (`plugin::magic-sessionmanager.impersonate.admins`) and the **Allow impersonation** switch.
|
|
1067
1083
|
|
|
1068
1084
|
**Anti-escalation (server-side).** Refused with 403 and `details.reason`:
|
|
1069
1085
|
|
|
1070
1086
|
- `self`: nobody views themselves;
|
|
1071
|
-
- `super-admin`: nobody views a Super Admin, Super Admins included;
|
|
1087
|
+
- `super-admin`: nobody views a Super Admin, Super Admins included. Since 4.22.1 a caller without `admin::users.read` gets the same 404 as for an unknown id, so the preview does not reveal which admins are Super Admins;
|
|
1072
1088
|
- `not-subset`: a non-Super-Admin views only an admin whose every effective permission they hold themselves (`details.uncovered` counts the others). The comparison follows Strapi's own permission ceiling rules: conditions are OR-ed, so a conditional permission does not cover an unconditional one; a property the holder does not restrict covers every value; a parent field covers its nested fields; unregistered conditions and, on localized types, missing locales are read the way the engine enforces them. A test compares it with Strapi 5.63's `isPermissionWithinCeiling` on more than 20,000 permission pairs;
|
|
1073
1089
|
- `api-token`: admin API tokens cannot start one;
|
|
1074
1090
|
- nesting is impossible: a preview creates no credential, and an app-user impersonation token cannot reach admin routes (401).
|
|
1075
1091
|
|
|
1076
1092
|
The preview is visible only to the admin who started it. Admin names in it and in the list need Strapi's **Read** permission on Users (`admin::users.read`), as in the Admin panel view.
|
|
1077
1093
|
|
|
1078
|
-
**
|
|
1094
|
+
**Signing in as the admin.** To work in the admin panel as that admin, with their menu and permissions, use [Sign in as another admin](#sign-in-as-another-admin) (4.23). The preview stays the lighter option: it creates no session and cannot change anything, so Content Manager activity is never attributed to a preview.
|
|
1095
|
+
|
|
1096
|
+
### Sign in as another admin
|
|
1097
|
+
|
|
1098
|
+
Since 4.23 an admin can work in the admin panel **as another admin**, with that admin's menu, content types and permissions, in a separate browser tab, for 15 or 30 minutes. The admin's own tabs stay signed in as themselves the whole time. Off by default.
|
|
1099
|
+
|
|
1100
|
+
**Turn it on.** The **Allow impersonation** switch (Settings › Session Manager › Impersonation) and the permission **Sign in as another admin** (`plugin::magic-sessionmanager.impersonate.admins.sign-in`, Settings › Administration Panel › Roles › Plugins › Session Manager › Impersonation). The Super Admin role holds it automatically; other roles only when granted. It is a separate permission from **View admin permissions**.
|
|
1101
|
+
|
|
1102
|
+
**Start.** Session Manager › Admin panel › row action **Sign in as** (the key icon; on narrow screens a **Sign in as** button). The dialog asks for a reason (3 to 255 characters, stored in the security log), the duration (15 or 30 minutes) and **Allow changes** (off by default; when you tick it, a warning explains that your changes will show as made by the other admin). **Start sign-in** then offers **Open tab signed in as …**: a link that opens a new tab and works once, within one minute. The new tab shows a dark bar on every page: "Signed in as … · Read-only (or Changes allowed) · Ends in mm:ss · End impersonation".
|
|
1103
|
+
|
|
1104
|
+
**End.** **End impersonation** in the bar; **End** in **Active impersonations** (on the Admin panel page and in Settings › Impersonation); Strapi's own **Log out** in that tab; signing out in your own tab; turning the switch off; or the end of the duration. The tab then shows "The impersonation ended" with **Close tab** and **Back to my admin panel**. Ending deletes exactly one Strapi admin session, the one created for the impersonation. Your own sessions and the other admin's own sessions are never touched (real-HTTP and two-tab browser tests prove it).
|
|
1105
|
+
|
|
1106
|
+
**Security model.**
|
|
1107
|
+
|
|
1108
|
+
- **Who.** Only roles with **Sign in as another admin**, only while the switch is on, only signed-in admins (admin API tokens: 403 `api-token`). Never yourself (`self`), never a Super Admin, Super Admins included (`super-admin`; a caller without `admin::users.read` gets 404 instead, as for the preview), never an account that is not active (`inactive`), and a non-Super-Admin only an admin whose every effective permission they hold themselves (`not-subset`, the same comparison as the preview). One running sign-in per target admin (`already-active`). No nesting: an impersonation session cannot start another one (`nested`), and every route of this plugin except its own two tab routes refuses changes from it.
|
|
1109
|
+
- **The session.** When the new tab redeems the code, the server creates a Strapi admin session for the target with `strapi.sessionManager('admin').generateRefreshToken(adminId, deviceId, { type: 'session', metadata })` on its own device id (`msm-admin-impersonation-…`, metadata `deviceName: 'Impersonation'`, `msmImpersonation: <id>`), sets the session's expiry to the end of the impersonation (Strapi's admin auth strategy checks it on every request), and returns one access token. The refresh token never leaves the server, so the tab cannot renew the session, and Strapi's access-token lifespan (`admin.auth.sessions.accessTokenLifespan`, default 30 minutes) is the upper bound: durations longer than it are not offered. The other admin sees the session as "Impersonation" in their own **Profile › Sessions** while it runs.
|
|
1110
|
+
- **The code.** 32 random bytes, stored as a SHA-256 hash, valid 60 seconds, single use (atomic). It travels in the URL fragment (`#code=…`), which browsers never send to a server, and the tab removes it from the address bar at once. Only the admin who started the sign-in can redeem it: the exchange runs with that admin's own token and still needs the permission.
|
|
1111
|
+
- **Read-only by default.** A server middleware recognises the session (signed token plus the session marker) on every admin request and refuses every method other than GET, HEAD and OPTIONS with 403 `impersonation-read-only`, except Strapi's read-only `POST /admin/permissions/check`. Strapi shows the refusal as a normal error notification.
|
|
1112
|
+
- **Never, even with "Allow changes".** 403 `impersonation-identity` for the other admin's account, password and sessions (`/admin/users/me…`), admin users and invitations (`/admin/users…`), roles, API and transfer tokens, SSO providers, sign-in, registration, password reset and token renewal routes, and every change route of this plugin.
|
|
1113
|
+
- **Logout.** `POST /admin/logout` with the impersonation's token never reaches Strapi: Strapi's logout without a device id deletes every session of the signed-in admin, which here would be the other admin's. The middleware ends the impersonation instead and answers 200.
|
|
1114
|
+
- **Attribution.** With **Allow changes** Strapi records changes as made by the other admin: `updatedBy`/`createdBy`, "Last edited by", the history and Strapi's own audit log show that admin, because Strapi has no notion of acting on behalf of someone. The plugin records every allowed change in its security log as `impersonation.write` with the real admin as the actor and `meta.impersonating` = the other admin, plus `meta.method`, `meta.route` (no query string, no body) and `meta.status`. Refused requests are recorded as `impersonation.refused` (`call-read-only`, `call-identity`; at most one per minute and reason). The sign-in history of the other admin lists all of it under the filter **Impersonation**.
|
|
1115
|
+
- **Expiry.** At most 30 minutes, enforced on the server (session expiry, the middleware and the 30-second sweep) and shown in the bar.
|
|
1116
|
+
|
|
1117
|
+
**How the tab stays separate.** Strapi's admin panel keeps one access token for all tabs of a browser (`localStorage.jwtToken`, or the access cookie when "Remember me" is off) and renews it with `POST /admin/access-token` and the shared httpOnly refresh cookie; no public API sets it per tab. The plugin's admin code therefore isolates the impersonation tab itself, and only while that tab's own `sessionStorage` holds the impersonation (sessionStorage belongs to one tab): reads of `jwtToken` and `isLoggedIn` answer with the impersonation token and writes to them are dropped, the access cookie is hidden in that tab, and its `fetch` never calls `/admin/access-token` (so the real admin's refresh cookie is neither used nor rotated), never signs in, and turns `/admin/logout` into "end this impersonation". This runs before Strapi reads the token. Every other tab keeps reading the shared storage, so it stays the real admin. A tab duplicated from the impersonation tab inherits its sessionStorage and is the same impersonation.
|
|
1118
|
+
|
|
1119
|
+
**Version guard.** The tab separation relies on Strapi admin internals that have been identical from 5.50.0 to 5.64.0 (checked in the installed sources: `reducer.mjs` `getStoredToken`, `utils/getFetchClient.mjs`, `features/Auth.mjs`). On any other Strapi release (an untested minor such as 5.65, or a new major) **Sign in as** is disabled with the reason shown in its tooltip and dialog, and the server answers 403 `unsupported`, until a plugin release has been tested against it. `GET /impersonation/status` reports `adminSignIn: { supported, version, reason, durations }`.
|
|
1120
|
+
|
|
1121
|
+
**Not covered.** The impersonation tab uses the other admin's permissions, nothing more; it cannot reach the Content API with that token. Requests your own admin routes make are restricted like every other admin request (read-only unless allowed; identity paths never). Browser extensions or scripts in the same browser profile can read sessionStorage like any page script.
|
|
1079
1122
|
|
|
1080
|
-
**Works councils and GDPR (information, not legal advice).** Acting as a user processes that user's personal data. A typical basis is a legitimate interest in support and in fixing faults (Art. 6(1)(f) GDPR) or the contract with the user; tell users in your privacy information (Art. 13) and consider turning on the email notice. The security log shows which admin did what and when; in Germany a technical system that can monitor employees' behaviour or performance is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist elsewhere. Agree the feature with the works council where there is one before you turn it on, keep the circle of roles small, and check whether a data protection impact assessment (Art. 35 GDPR) is needed.
|
|
1123
|
+
**Works councils and GDPR (information, not legal advice).** Acting as a user processes that user's personal data. A typical basis is a legitimate interest in support and in fixing faults (Art. 6(1)(f) GDPR) or the contract with the user; tell users in your privacy information (Art. 13) and consider turning on the email notice. The security log shows which admin did what and when; in Germany a technical system that can monitor employees' behaviour or performance is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist elsewhere. Agree the feature with the works council where there is one before you turn it on, keep the circle of roles small, and check whether a data protection impact assessment (Art. 35 GDPR) is needed. **Sign in as another admin** concerns employees on both sides: the admin who is signed in as sees the other admin's work view, and, with **Allow changes**, Strapi shows the changes as that admin's work, while the security log records who really made them. In Germany both the impersonation itself and the log of what the impersonating admin did are matters for co-determination; agree when it may be used (for example only with a ticket and with the other admin informed), whether **Allow changes** may be used at all, and who may read the log. Tell the admins concerned that their account can be used this way.
|
|
1081
1124
|
|
|
1082
1125
|
## Running several instances (Railway replicas, pm2 cluster)
|
|
1083
1126
|
|
|
@@ -1117,7 +1160,7 @@ What stays per process, by design: the fail-open error budget in Relaxed token c
|
|
|
1117
1160
|
});
|
|
1118
1161
|
```
|
|
1119
1162
|
|
|
1120
|
-
With `proxy.koa` on,
|
|
1163
|
+
With `proxy.koa` on, Koa reads the client IP from `X-Forwarded-For`, limited to the last `maxIpsCount` entries; the plugin uses that address (see [Client IP address](#client-ip-address)). Only enable it behind a proxy you control.
|
|
1121
1164
|
|
|
1122
1165
|
4. **pm2 in cluster mode** (one container or VM):
|
|
1123
1166
|
|
|
@@ -1252,7 +1295,7 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
1252
1295
|
|
|
1253
1296
|
## Security and privacy
|
|
1254
1297
|
|
|
1255
|
-
- **Encryption key.** Stored tokens are encrypted with AES-256-GCM using `SESSION_ENCRYPTION_KEY`. In production, startup fails without it. Outside production a derived development key is used with a warning. Changing the key makes existing encrypted tokens unreadable, so keep it stable. Generate one in **Configuration › Sessions › Advanced** ("Copy for .env" copies `SESSION_ENCRYPTION_KEY="…"`; nothing is saved in Strapi) or with:
|
|
1298
|
+
- **Encryption key.** Stored tokens are encrypted with AES-256-GCM using `SESSION_ENCRYPTION_KEY`. In production, startup fails without it. Outside production a derived development key is used with a warning. Use at least 32 random bytes: a shorter key still works in 4.x but logs an error at every start and is recorded once in the security log (`config.encryption-key.weak`); the next major version will refuse it. Changing the key makes existing encrypted tokens unreadable, so keep it stable. Generate one in **Configuration › Sessions › Advanced** ("Copy for .env" copies `SESSION_ENCRYPTION_KEY="…"`; nothing is saved in Strapi) or with:
|
|
1256
1299
|
|
|
1257
1300
|
```bash
|
|
1258
1301
|
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
|
|
@@ -1267,7 +1310,7 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
1267
1310
|
- **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.
|
|
1268
1311
|
- **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.
|
|
1269
1312
|
- **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.
|
|
1270
|
-
- **Impersonation.** Off by default; only roles with **Impersonate app users**, only signed-in admins, at most 60 minutes, credential and account changes refused, every start, end, expiry and refusal in the security log.
|
|
1313
|
+
- **Impersonation.** Off by default; only roles with **Impersonate app users**, only signed-in admins, at most 60 minutes, credential and account changes refused, every start, end, expiry and refusal in the security log. **View permissions** shows a read-only permission preview of an admin; **Sign in as another admin** (4.23) opens a separate tab with a real admin session of another admin, read-only unless changes are allowed, never for Super Admins or wider roles, every change recorded for the real admin. Details: [Impersonation](#impersonation).
|
|
1271
1314
|
- **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).
|
|
1272
1315
|
|
|
1273
1316
|
---
|
|
@@ -1276,17 +1319,18 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
1276
1319
|
|
|
1277
1320
|
Information for your records of processing, a data protection impact assessment or a works agreement (Germany: section 87(1) no. 6 BetrVG when the users are employees). It describes the software, not your legal basis; it is not legal advice.
|
|
1278
1321
|
|
|
1279
|
-
| Data
|
|
1280
|
-
|
|
|
1281
|
-
| App-user session: user, sign-in, last activity and sign-out time, end reason, IP address, browser, system, device type, country and city (when location lookup is on)
|
|
1282
|
-
| Device key (HMAC of browser family, system family, device type and the app's `deviceId`)
|
|
1283
|
-
| Rounded location (0.1 degree, about 11 km)
|
|
1284
|
-
| Failed and refused app-user sign-ins, locks, unlocks (with the admin who unlocked), session-limit and password-change endings, new device, impossible travel, "This wasn't me", data exports
|
|
1285
|
-
| Unknown-account sign-ins
|
|
1286
|
-
| Lock counters
|
|
1287
|
-
| "Locked now" entries
|
|
1288
|
-
| Admin sign-ins and, opt-in, Content Manager activity
|
|
1289
|
-
| Impersonations: admin, user, reason, duration, start and end; refused starts and refused requests
|
|
1322
|
+
| Data | When it is recorded | Where | Kept for | Who can see it | Switch |
|
|
1323
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1324
|
+
| App-user session: user, sign-in, last activity and sign-out time, end reason, IP address, browser, system, device type, country and city (when location lookup is on) | Every sign-in and while the session is used | `magic_sessions` | Ended sessions: `retentionDays` (default 90; presets 7, 90, 365; or forever) | Admins with **Access the Session Manager plugin**; the user through the Content API | IP shortening: **Shorten IP addresses of sessions** (off); location: **IP location lookup** |
|
|
1325
|
+
| Device key (HMAC of browser family, system family, device type and the app's `deviceId`) | Every sign-in | `magic_sessions.device_key` | With the session | Nobody in the UI (used only to compare devices) | Always; it cannot be turned back into the device |
|
|
1326
|
+
| Rounded location (0.1 degree, about 11 km) | Every sign-in while **Detect impossible travel** is on | Inside the session's location | With the session | Admins with plugin access | **Detect impossible travel** (off) |
|
|
1327
|
+
| Failed and refused app-user sign-ins, locks, unlocks (with the admin who unlocked), session-limit and password-change endings, new device, impossible travel, "This wasn't me", data exports | When they happen | `magic_sessions_security_events` | `securityLogRetentionDays` (default 90) | Admins with **View app-user security activity** (emails only with Content Manager read access to users), the user (own-data export) | **Record failed and refused sign-ins** (on) for failed/refused/locks; the others only while their feature is on |
|
|
1328
|
+
| Unknown-account sign-ins | Once per anonymised address per 5 minutes | Same log, without account and without the typed name | Same | Same | Same |
|
|
1329
|
+
| Lock counters | During the counting window and the lock | `magic_sm_counters` (SHA-256 hashes of IP and identifier) | Until the lock ends | Nobody (hashes) | Lockout thresholds; 0 turns a lock off |
|
|
1330
|
+
| "Locked now" entries | While a lock lasts | `magic_sm_cache` | Until the lock ends | Admins with plugin access | Follows the log's IP options |
|
|
1331
|
+
| Admin sign-ins and, opt-in, Content Manager activity | See [Admin activity](#admin-activity-and-sign-in-history) | Security log | `securityLogRetentionDays` | Admins with **View admin activity** | **Record admin sign-ins** (on), **Record Content Manager activity** (off) |
|
|
1332
|
+
| Impersonations: admin, user, reason, duration, start and end; refused starts and refused requests | When an admin impersonates a user | `magic_sessions_impersonations` and the security log | Table: 7 days after the end; log: `securityLogRetentionDays` | Admins with **Impersonate app users** (list), **View admin activity** (log) | **Allow impersonation** (off) |
|
|
1333
|
+
| Sign-ins as another admin (4.23): real admin, target admin, reason, duration, whether changes were allowed, start and end; every change made (method, path, status) and every refused request | When an admin signs in as another admin | `magic_sessions_impersonations`, the security log, and one Strapi `admin::session` row for the duration | Table: 7 days after the end; log: `securityLogRetentionDays`; session: deleted at the end | Admins with **Sign in as another admin** or **View admin permissions** (list), **View admin activity** (log); the target admin sees the session in their own profile | **Allow impersonation** (off) |
|
|
1290
1334
|
|
|
1291
1335
|
What leaves the server, only when you turn it on: security emails through Strapi's email provider; Discord, Slack and the signed webhook with the selected events (user documentId, IP as the log stores it, browser, country, city, event details; never email addresses or passwords); IP lookups at ipapi.co only with the `auto`/`ipapi` provider. No telemetry.
|
|
1292
1336
|
|