strapi-plugin-magic-sessionmanager 4.14.3 → 4.15.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 +48 -0
- package/README.md +124 -77
- package/dist/admin/{Analytics-DSpn7W5A.js → Analytics-Dbs5QXLb.js} +1 -1
- package/dist/admin/{Analytics-CFEgpg-G.mjs → Analytics-HK6_TEmk.mjs} +1 -1
- package/dist/admin/{App-UlRrLKcx.js → App-7SxOBJP5.js} +59 -26
- package/dist/admin/{App-BBne8xI6.mjs → App-BOFzZ5d8.mjs} +59 -26
- package/dist/admin/{OnlineUsersWidget-C3YMTEGD.mjs → OnlineUsersWidget-CoCxnww-.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-GFcYyZ9L.js → OnlineUsersWidget-Dns_74xJ.js} +1 -1
- package/dist/admin/{Settings-DVhW9XHB.js → Settings-B6CrR-07.js} +257 -64
- package/dist/admin/{Settings-BbUNvjno.mjs → Settings-DYRShQ8W.mjs} +258 -65
- package/dist/admin/{de-BlKn1pSD.mjs → de-B3mPtxsW.mjs} +39 -7
- package/dist/admin/{de-B0CBR1Dw.js → de-bkkCvSxX.js} +39 -7
- package/dist/admin/{en-IT0YTY8f.mjs → en-BnU8BNkN.mjs} +39 -7
- package/dist/admin/{en-D0ZGIIjz.js → en-DMICyIow.js} +39 -7
- package/dist/admin/{es-BCGzaaCh.mjs → es-BxMgfJ1Y.mjs} +39 -7
- package/dist/admin/{es-CWee-XCR.js → es-OSzHGRIu.js} +39 -7
- package/dist/admin/{fr-rQS1M7jE.js → fr-Bu_8miJ4.js} +39 -7
- package/dist/admin/{fr-xBIH4Byq.mjs → fr-WPrbtx8k.mjs} +39 -7
- package/dist/admin/{index-1KmiZSfy.js → index-CNSJITRX.js} +9 -9
- package/dist/admin/{index-MOJkFXcZ.mjs → index-lnZBc5n0.mjs} +9 -9
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-C-yTLhnS.js → pt-B08xnb0K.js} +39 -7
- package/dist/admin/{pt-DWDeIDVa.mjs → pt-C41KyEDN.mjs} +39 -7
- package/dist/admin/riskData-BVs9GpgD.js +26 -0
- package/dist/admin/riskData-CI1gm2yI.mjs +27 -0
- package/dist/server/index.js +565 -178
- package/dist/server/index.mjs +565 -178
- package/package.json +1 -1
- package/scripts/geoip-updater.cjs +58 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
# [4.15.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.3...v4.15.0) (2026-11-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* honest risk data and VPN, proxy, Tor and hosting detection with local MaxMind databases ([#33](https://github.com/Schero94/Magic-Sessionmanager/issues/33)) ([80e1e7e](https://github.com/Schero94/Magic-Sessionmanager/commit/80e1e7e988f048b4716dfd0dc8487cef4cec37cd))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Release type: minor (`feat` for the new risk data source, `fix` for the honest UI). No breaking change for the HTTP API or stored settings; see the upgrade note for `securityScore: null`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
* **Real risk data from a local MaxMind database.** Configuration › Location data › **Risk data (VPN, proxy, Tor)** downloads, with the existing MaxMind credentials, either the **GeoIP2 Anonymous IP** database (paid: VPN, public and residential proxies, Tor exit nodes, hosting providers) or the free **GeoLite2 ASN** database, used as a clearly labelled **heuristic** for large hosting and cloud networks only. Lookups are local through the installed `@maxmind/geoip2-node` (`anonymousIP()`, `asn()`); no IP address leaves the server and the license key never reaches the browser.
|
|
14
|
+
* With a risk source, "Reject suspicious sign-ins" refuses Tor exit nodes (`tor_exit_node`), VPNs and proxies, and scores below 50; hosting networks raise the suspicious-sign-in email and `login.suspicious` but are never refused. The VPN or proxy email fires for VPNs and proxies. Risk data is evaluated even when the location lookup itself failed.
|
|
15
|
+
* Lookup results add `isTor`, `isHosting`, `isAnonymous`, `isPublicProxy`, `isResidentialProxy` and `riskSource`; the existing names (`isVpn`, `isProxy`, `isThreat`, `securityScore`, `riskLevel`) keep their meaning. With the ASN database, `asn` and `org` are filled when the location provider gave none.
|
|
16
|
+
* `GET /magic-sessionmanager/geoip/status` reports `risk` (`available`, `source`, and per database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`). `POST /magic-sessionmanager/geoip/update` accepts `database: 'location' | 'anonymous-ip' | 'asn'` (default `location`, anything else 400). A 401 or 403 from MaxMind answers 502 with "MaxMind refused the download. Check the credentials and that your account includes this database."
|
|
17
|
+
* The CLI updater accepts `MAXMIND_EDITION_ID=GeoIP2-Anonymous-IP` and `GeoLite2-ASN`; risk databases always go to their own file in `data/magic-sessionmanager/geoip/` and cannot be selected as the location database. New environment variables `MAGIC_SESSIONMANAGER_ANONYMOUS_IP_DATABASE` and `MAGIC_SESSIONMANAGER_ASN_DATABASE` point at existing files instead.
|
|
18
|
+
* Session details show "Hosting network" for live lookups, "Not available" for VPN and proxy when only the ASN heuristic answered, and a note on heuristic scores.
|
|
19
|
+
* MaxMind database readers watch their file without keeping the Node.js process alive.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
* **Suspicious sign-in detection was never active, and the admin and README said it was.** The plugin read VPN, proxy and threat flags from a `threat` object that ipapi.co does not send ([ipapi.co API](https://ipapi.co/api/) documents no such field), and it scored every local GeoLite2 result 100. So every flag was `false` and every score 100: "Reject suspicious sign-ins", the suspicious-sign-in email, the VPN or proxy email and the `login.suspicious` team notification could never fire. The dead parsing is removed. ipapi.co and GeoLite2 still provide location data; they no longer pretend to provide risk data.
|
|
24
|
+
* Without a risk data source, lookups report no risk data: the flags stay `false` (same field names), `securityScore` is `null` instead of a fake 100 (or 50 for failed and disabled lookups), `riskLevel` is `'Unknown'` and the new field `riskSource` is `null`. New sessions store `securityScore: null`; a session's `geoLocation` stores `riskSource` when risk data existed.
|
|
25
|
+
* Risk rules and alerts run only on results with a `riskSource`. Flags without one never refuse a sign-in, never send the suspicious-sign-in or VPN or proxy email, and never turn a team notification into `login.suspicious`.
|
|
26
|
+
* **Admin, Configuration:** while no risk data source is set up, "Reject suspicious sign-ins", "Security scoring" and the email types "Suspicious sign-in" and "VPN or proxy" are shown off and disabled with "Needs a risk data source" and a link to Location data. Login protection shows a "No risk data source" notice; Alerts says that `login.suspicious` is never sent. The hints no longer claim ipapi.co detects VPNs or that local results score 100.
|
|
27
|
+
* **Admin, Session details:** without risk data, one "Not available" row with "Set up risk data" replaces the security score, VPN and proxy rows. Sessions recorded before this release show "Not available", because their stored 100 was never a real check.
|
|
28
|
+
* Discord and Slack messages list risk findings only when the sign-in had risk data, and now also name Tor and hosting networks. The `{{reason.securityScore}}` email variable renders `N/A` instead of `0` when there is no score.
|
|
29
|
+
* README: the features table, Session details, the settings table, Location data, Login protection and Alerts describe what needs a risk data source; a new "Risk data (VPN, proxy, Tor)" section explains the previous behaviour.
|
|
30
|
+
|
|
31
|
+
* **A custom "Database file name" was never found.** The reader resolved `geoIpDatabasePath` (for example `GeoLite2-Country.mmdb`) against the Strapi folder, while the admin and CLI downloads write it to `data/magic-sessionmanager/geoip/`. A file name is now read from that folder first; a file in the Strapi folder is still found for older setups, and absolute paths are unchanged. The settings API keeps refusing `..` and folder names with a field error on `geoIpDatabasePath`.
|
|
32
|
+
|
|
33
|
+
### Upgrade note
|
|
34
|
+
|
|
35
|
+
* Saved settings are kept as they are. A risk switch that was on stays stored, has no effect while no risk data source exists, and applies again once one is set up. The admin says "Saved as on. It takes effect once a risk data source is set up."
|
|
36
|
+
* Nothing changes until you add a risk database. **Check your switches before you download one:** a "Reject suspicious sign-ins" saved as on starts refusing VPN, proxy and Tor sign-ins as soon as the database is present, and the suspicious-sign-in and VPN or proxy emails (on by default once "Send security emails" is on) start to be sent.
|
|
37
|
+
* One rule keeps its previous behaviour: with `geoLookupFailureMode: 'auto'` and "Reject suspicious sign-ins" saved as on, a sign-in whose location cannot be determined is still rejected. Choose **Allow sign-in** under Login protection › Advanced › "If the location cannot be determined" to change that.
|
|
38
|
+
* Code that reads `securityScore` must accept `null`. Code that relied on `securityScore: 100` for local results, or on `isVpn`/`isProxy` from ipapi.co, never received real data; check `riskSource` instead.
|
|
39
|
+
* Stored sessions are not rewritten. Their old scores of 100 stay in the database; the admin ignores them because they carry no `riskSource`.
|
|
40
|
+
|
|
41
|
+
### Tests
|
|
42
|
+
|
|
43
|
+
* `tests/geolocation-database-path.test.js` (regression, fails before the fix): a custom file name is read from the GeoIP folder, the Strapi-folder fallback and absolute paths still work, a missing file is reported for the GeoIP folder, and `..` or folder names are refused with a `geoIpDatabasePath` field error.
|
|
44
|
+
* `tests/risk-databases.test.js` reads synthetic MMDB fixtures (written by `tests/helpers/mmdb-writer.js`; no MaxMind data is shipped) with the real `@maxmind/geoip2-node` reader: VPN, Tor, hosting, public and residential proxy and a clean address; the ASN heuristic; both databases; a wrong database type; the status report; and full sign-ins where the reject rule, the VPN and suspicious emails (through the real notification service) and the `login.suspicious` Discord post actually fire. Also the download routing, the fixed refusal message and that a location setting cannot select a risk file.
|
|
45
|
+
* `tests/risk-honesty.test.js`: ipapi.co answers (even with a made-up `threat` object), failed and private lookups carry no score; without a source nothing is suspicious, no risk email or `login.suspicious` webhook is sent, and the new-country alert still works.
|
|
46
|
+
* `tests/admin/risk-honesty.test.jsx` renders the Configuration page and the session details: without a source the risk controls are off, disabled and explained, saved values are kept and nothing is saved; with a source they are live.
|
|
47
|
+
* `tests/geo-firewall.test.js`: flags without a source refuse nothing; the saved reject switch keeps the Automatic fail-closed rule.
|
|
48
|
+
|
|
1
49
|
## [4.14.3](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.2...v4.14.3) (2026-11-24)
|
|
2
50
|
|
|
3
51
|
|
package/README.md
CHANGED
|
@@ -58,19 +58,19 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
|
|
|
58
58
|
|
|
59
59
|
## Features
|
|
60
60
|
|
|
61
|
-
| Area | What you get
|
|
62
|
-
| ---------------------- |
|
|
63
|
-
| 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, security score). |
|
|
64
|
-
| 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.
|
|
65
|
-
| 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.
|
|
66
|
-
| Login protection | Temporary IP lockout after failed sign-ins, Content API rate limits, optional rejection of VPN, proxy or low-score sign-ins, and country allow or block lists.
|
|
67
|
-
| Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off.
|
|
68
|
-
| Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack.
|
|
69
|
-
| Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage.
|
|
70
|
-
| 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.
|
|
71
|
-
| Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`.
|
|
72
|
-
| Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database.
|
|
73
|
-
| Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry.
|
|
61
|
+
| Area | What you get |
|
|
62
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
63
|
+
| 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). |
|
|
64
|
+
| 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. |
|
|
65
|
+
| 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. |
|
|
66
|
+
| 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. |
|
|
67
|
+
| Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
|
|
68
|
+
| Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
|
|
69
|
+
| Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
|
|
70
|
+
| 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. |
|
|
71
|
+
| Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
|
|
72
|
+
| Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
|
|
73
|
+
| Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
|
|
74
74
|
|
|
75
75
|
---
|
|
76
76
|
|
|
@@ -208,7 +208,7 @@ Open **Session Manager** and switch to **Admin panel** (the switch below the tit
|
|
|
208
208
|
### Session details
|
|
209
209
|
|
|
210
210
|
- A state sentence that explains why the session is in its state, for example "Ended {time} · Ended manually."
|
|
211
|
-
- **User** (with an **Open user** link to the Content Manager), **Session** (Signed in, Last active, Ended at, End reason), **Device** (type, browser, operating system, IP address), **Location and security** (country, city, time zone, security score "{score}/100", VPN and proxy).
|
|
211
|
+
- **User** (with an **Open user** link to the Content Manager), **Session** (Signed in, Last active, Ended at, End reason), **Device** (type, browser, operating system, IP address), **Location and security** (country, city, time zone, and security score "{score}/100", VPN and proxy when the sign-in had [risk data](#risk-data-vpn-proxy-tor); otherwise one "Not available" row with a link to set up risk data. Sessions recorded before 4.15 show "Not available", because their stored score of 100 was never a real check).
|
|
212
212
|
- **Look up location** for sessions without a stored location. The lookup runs only when you click it, because it can send the IP address to ipapi.co.
|
|
213
213
|
- **Technical details** (collapsed): record ID with a copy button and the raw user agent.
|
|
214
214
|
- Footer: **End session** with confirmation on open sessions; ended sessions show "This session has already ended."
|
|
@@ -237,7 +237,7 @@ Two links: **Configuration** and **Analytics**.
|
|
|
237
237
|
| ---------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
238
238
|
| **Sessions** | How long does a session stay valid? | Inactivity timeout, maximum session age; Advanced: "Last active" update interval, idle check interval and method. Token check (Strict / Relaxed); Advanced: grace period after sign-in, token encryption key generator. A read-only card on what your app receives when a session is rejected. |
|
|
239
239
|
| **Login protection** | Which sign-ins are refused, and why? | Temporary IP lockout, Trust proxy headers, Reject suspicious sign-ins, If the location cannot be determined, Country rules (Allow only listed countries / Reject listed countries), a read-only card on why sign-ins are refused. |
|
|
240
|
-
| **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.
|
|
240
|
+
| **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
241
|
| **Alerts** | Who is told about sign-ins? | Security emails to users (with email templates) and Team notifications to Discord or Slack. |
|
|
242
242
|
| **Data and retention** | How long is session history kept? | Keep ended sessions for, and **Delete ended sessions**. |
|
|
243
243
|
|
|
@@ -369,41 +369,43 @@ export default () => ({
|
|
|
369
369
|
|
|
370
370
|
Static defaults from `server/src/config/index.js`; admin units and ranges from the settings validation in `server/src/controllers/settings.js`. Out-of-range admin values are rejected with a field error, not clamped silently.
|
|
371
371
|
|
|
372
|
-
| Key | Default | Admin unit and range | Configuration tab | Meaning
|
|
373
|
-
| ------------------------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------- | ----------------------------- |
|
|
374
|
-
| `inactivityTimeout` | 15 min (`900000` ms) | min, 1 to 1440 | Sessions | Unused this long, a session becomes idle and then ends as "Timed out". Also decides who counts as online.
|
|
375
|
-
| `maxSessionAgeDays` | 30 | days, 1 to 365 | Sessions | Maximum age from sign-in, regardless of activity. Applied on the session's next request.
|
|
376
|
-
| `lastSeenRateLimit` | 30 s (`30000` ms) | s, 5 to 300 | Sessions › Advanced | Minimum interval between "Last active" updates.
|
|
377
|
-
| `cleanupInterval` | 30 min (`1800000` ms) | min, 5 to 1440 | Sessions › Advanced | How often the idle check runs. It ends idle sessions and deletes nothing. It also runs at server start; with several instances only one runs it per interval.
|
|
378
|
-
| `cleanupUseDbDirect` | `false` | boolean | Sessions › Advanced | Idle check with one SQL update instead of the Document Service (skips lifecycle hooks).
|
|
379
|
-
| `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.
|
|
380
|
-
| `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.
|
|
381
|
-
| `maxFailedLogins` | 5 | 0 to 100, 0 = off | Login protection | Temporary IP lockout threshold (failed sign-ins from one IP within 15 minutes).
|
|
382
|
-
| `trustedProxies` | off | boolean | Login protection | Read the client IP from proxy headers. Only behind a proxy you control.
|
|
383
|
-
| `blockSuspiciousSessions` | `false` | boolean | Login protection | Reject suspicious sign-ins.
|
|
384
|
-
| `geoLookupFailureMode` | `'auto'` | auto, allow, block | Login protection | What happens when the location cannot be determined.
|
|
385
|
-
| `enableGeofencing` | `false` | boolean | Login protection | Use country rules.
|
|
386
|
-
| `allowedCountries` / `blockedCountries` | `[]` | ISO 3166-1 alpha-2 codes | Login protection | Allow only listed countries / Reject listed countries.
|
|
387
|
-
| `enableGeolocation` | `true` | boolean | Location data | IP location lookup at sign-in. Required by country rules, suspicious-sign-in checks and alerts.
|
|
388
|
-
| `enableSecurityScoring` | `true` | boolean | Location data | Apply the security score thresholds (below 70: suspicious-sign-in email, below 50: rejection if enabled).
|
|
389
|
-
| `geoIpProvider` | `'auto'` | auto, local-mmdb, ipapi, disabled | Location data | Where location data comes from.
|
|
390
|
-
| `geoIpDatabasePath` | `MAGIC_SESSIONMANAGER_GEOIP_DATABASE` or `''` | file name | Location data › Advanced | Local MaxMind-compatible database.
|
|
391
|
-
| `enableEmailAlerts` | `false` | boolean | Alerts | Security emails to users.
|
|
392
|
-
| `alertOnSuspiciousLogin` / `alertOnNewLocation` / `alertOnVpnProxy` | `true` | boolean | Alerts | Which events send an email.
|
|
393
|
-
| `enableWebhooks` | `false` | boolean | Alerts | Team notifications.
|
|
394
|
-
| `discordWebhookUrl` / `slackWebhookUrl` | `''` | https URL on discord.com / discordapp.com, or hooks.slack.com | Alerts | Any other host is rejected.
|
|
395
|
-
| `retentionDays` | 90 | days, 1 to 365 or -1 (forever) | Data and retention | How long records of ended sessions are kept. Checked once a day across all instances, the first time about 5 minutes after the server starts. Open sessions are never deleted by retention.
|
|
396
|
-
| `rateLimitWriteMax` / `rateLimitReadMax` / `rateLimitWindowSeconds` | 10 / 120 / 60 | 1 to 1000 / 1 to 10000 / 10 to 3600 | not shown | Content API rate limits. Not editable in the UI; Save keeps the stored values. The write limit can only be made stricter than the route floor.
|
|
397
|
-
| `emailTemplates` | empty | subject ≤ 200, HTML ≤ 10,000 (sanitised), text ≤ 5,000 characters | Alerts › Edit email templates | As soon as any template has content, only stored templates are used. Fill in all three, or none.
|
|
372
|
+
| Key | Default | Admin unit and range | Configuration tab | Meaning |
|
|
373
|
+
| ------------------------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
374
|
+
| `inactivityTimeout` | 15 min (`900000` ms) | min, 1 to 1440 | Sessions | Unused this long, a session becomes idle and then ends as "Timed out". Also decides who counts as online. |
|
|
375
|
+
| `maxSessionAgeDays` | 30 | days, 1 to 365 | Sessions | Maximum age from sign-in, regardless of activity. Applied on the session's next request. |
|
|
376
|
+
| `lastSeenRateLimit` | 30 s (`30000` ms) | s, 5 to 300 | Sessions › Advanced | Minimum interval between "Last active" updates. |
|
|
377
|
+
| `cleanupInterval` | 30 min (`1800000` ms) | min, 5 to 1440 | Sessions › Advanced | How often the idle check runs. It ends idle sessions and deletes nothing. It also runs at server start; with several instances only one runs it per interval. |
|
|
378
|
+
| `cleanupUseDbDirect` | `false` | boolean | Sessions › Advanced | Idle check with one SQL update instead of the Document Service (skips lifecycle hooks). |
|
|
379
|
+
| `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. |
|
|
380
|
+
| `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. |
|
|
381
|
+
| `maxFailedLogins` | 5 | 0 to 100, 0 = off | Login protection | Temporary IP lockout threshold (failed sign-ins from one IP within 15 minutes). |
|
|
382
|
+
| `trustedProxies` | off | boolean | Login protection | Read the client IP from proxy headers. Only behind a proxy you control. |
|
|
383
|
+
| `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. |
|
|
384
|
+
| `geoLookupFailureMode` | `'auto'` | auto, allow, block | Login protection | What happens when the location cannot be determined. |
|
|
385
|
+
| `enableGeofencing` | `false` | boolean | Login protection | Use country rules. |
|
|
386
|
+
| `allowedCountries` / `blockedCountries` | `[]` | ISO 3166-1 alpha-2 codes | Login protection | Allow only listed countries / Reject listed countries. |
|
|
387
|
+
| `enableGeolocation` | `true` | boolean | Location data | IP location lookup at sign-in. Required by country rules, suspicious-sign-in checks and alerts. |
|
|
388
|
+
| `enableSecurityScoring` | `true` | boolean | Location data | Apply the security score thresholds (below 70: suspicious-sign-in email, below 50: rejection if enabled). Needs a [risk data source](#risk-data-vpn-proxy-tor). |
|
|
389
|
+
| `geoIpProvider` | `'auto'` | auto, local-mmdb, ipapi, disabled | Location data | Where location data comes from. |
|
|
390
|
+
| `geoIpDatabasePath` | `MAGIC_SESSIONMANAGER_GEOIP_DATABASE` or `''` | file name | Location data › Advanced | Local MaxMind-compatible database. A file name is read from `data/magic-sessionmanager/geoip/` (where downloads write it), then from the Strapi folder for older setups; an absolute path is used as it is. Names with `..` or folders are refused with a field error. A file name is read from `data/magic-sessionmanager/geoip/` (where downloads write it), then from the Strapi folder for older setups; an absolute path is used as it is. Names with `..` or folders are refused with a field error. |
|
|
391
|
+
| `enableEmailAlerts` | `false` | boolean | Alerts | Security emails to users. |
|
|
392
|
+
| `alertOnSuspiciousLogin` / `alertOnNewLocation` / `alertOnVpnProxy` | `true` | boolean | Alerts | Which events send an email. Suspicious sign-in and VPN or proxy need a [risk data source](#risk-data-vpn-proxy-tor). |
|
|
393
|
+
| `enableWebhooks` | `false` | boolean | Alerts | Team notifications. |
|
|
394
|
+
| `discordWebhookUrl` / `slackWebhookUrl` | `''` | https URL on discord.com / discordapp.com, or hooks.slack.com | Alerts | Any other host is rejected. |
|
|
395
|
+
| `retentionDays` | 90 | days, 1 to 365 or -1 (forever) | Data and retention | How long records of ended sessions are kept. Checked once a day across all instances, the first time about 5 minutes after the server starts. Open sessions are never deleted by retention. |
|
|
396
|
+
| `rateLimitWriteMax` / `rateLimitReadMax` / `rateLimitWindowSeconds` | 10 / 120 / 60 | 1 to 1000 / 1 to 10000 / 10 to 3600 | not shown | Content API rate limits. Not editable in the UI; Save keeps the stored values. The write limit can only be made stricter than the route floor. |
|
|
397
|
+
| `emailTemplates` | empty | subject ≤ 200, HTML ≤ 10,000 (sanitised), text ≤ 5,000 characters | Alerts › Edit email templates | As soon as any template has content, only stored templates are used. Fill in all three, or none. |
|
|
398
398
|
|
|
399
399
|
### Environment variables
|
|
400
400
|
|
|
401
|
-
| Variable
|
|
402
|
-
|
|
|
403
|
-
| `SESSION_ENCRYPTION_KEY`
|
|
404
|
-
| `MAGIC_SESSIONMANAGER_GEOIP_DATABASE`
|
|
405
|
-
| `MAXMIND_ACCOUNT_ID`, `MAXMIND_LICENSE_KEY`
|
|
406
|
-
| `
|
|
401
|
+
| Variable | Purpose |
|
|
402
|
+
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
403
|
+
| `SESSION_ENCRYPTION_KEY` | Key for AES-256-GCM encryption of stored tokens. Required when `NODE_ENV=production` (startup fails without it). Keep it stable. |
|
|
404
|
+
| `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`). |
|
|
405
|
+
| `MAXMIND_ACCOUNT_ID`, `MAXMIND_LICENSE_KEY` | MaxMind credentials for database updates. They take precedence over credentials stored in the admin. |
|
|
406
|
+
| `MAGIC_SESSIONMANAGER_ANONYMOUS_IP_DATABASE` | Path of a GeoIP2 Anonymous IP database (risk data). Default: `data/magic-sessionmanager/geoip/GeoIP2-Anonymous-IP.mmdb`. |
|
|
407
|
+
| `MAGIC_SESSIONMANAGER_ASN_DATABASE` | Path of a GeoLite2 ASN database (hosting heuristic). Default: `data/magic-sessionmanager/geoip/GeoLite2-ASN.mmdb`. |
|
|
408
|
+
| `MAXMIND_EDITION_ID` | Edition for the CLI updater, for example `GeoLite2-City`. |
|
|
407
409
|
|
|
408
410
|
---
|
|
409
411
|
|
|
@@ -426,7 +428,7 @@ The MaxMind database download is a separate authenticated network request; the M
|
|
|
426
428
|
|
|
427
429
|
### Local MaxMind database (recommended)
|
|
428
430
|
|
|
429
|
-
A local GeoLite2 City database avoids remote lookups in the sign-in path and gives country, city, region, time zone and coordinates. GeoLite2 Country databases are supported as a country-only fallback.
|
|
431
|
+
A local GeoLite2 City database avoids remote lookups in the sign-in path and gives country, city, region, time zone and coordinates. GeoLite2 Country databases are supported as a country-only fallback. Location databases (GeoLite2 and GeoIP2 City or Country) carry no VPN, proxy or Tor data, so they give no security score; see [Risk data](#risk-data-vpn-proxy-tor).
|
|
430
432
|
|
|
431
433
|
1. Create a free MaxMind account: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data/
|
|
432
434
|
2. In **Configuration › Location data**, choose the provider **Local database**, enter the MaxMind account ID and license key, and click **Update database**. The license key is stored in the plugin store and never returned to the browser.
|
|
@@ -443,6 +445,51 @@ npm run geoip:update # in the plugin repository
|
|
|
443
445
|
|
|
444
446
|
The updater checks MaxMind's `Last-Modified` header and skips the download when the local copy is current; add `--force` to download anyway. Schedule it weekly or twice weekly. MaxMind requires GeoLite databases to stay current and limits GeoLite users to 30 downloads per day.
|
|
445
447
|
|
|
448
|
+
### Risk data (VPN, proxy, Tor)
|
|
449
|
+
|
|
450
|
+
Location data answers "where is this address?", not "is it a VPN, proxy or Tor exit?". Neither location provider supplies risk data:
|
|
451
|
+
|
|
452
|
+
- ipapi.co's documented JSON response has no VPN, proxy or threat fields ([ipapi.co API](https://ipapi.co/api/)).
|
|
453
|
+
- GeoLite2 and GeoIP2 City or Country databases carry no anonymiser flags.
|
|
454
|
+
|
|
455
|
+
Up to 4.14, the plugin read a `threat` object that ipapi.co never sends and scored every local result 100. Every check below was therefore inactive, although this README described it as working. Since 4.15, these features need a **risk data source** and say so in the admin when none is set up:
|
|
456
|
+
|
|
457
|
+
| Feature | Without a risk data source |
|
|
458
|
+
| -------------------------------------------- | ------------------------------------------------------------------ |
|
|
459
|
+
| Reject suspicious sign-ins | Off and disabled; refuses nothing as suspicious. |
|
|
460
|
+
| Security scoring | Off and disabled; sessions store no score (`securityScore: null`). |
|
|
461
|
+
| Suspicious sign-in email, VPN or proxy email | Off and disabled; never sent. |
|
|
462
|
+
| `login.suspicious` team notification | Never sent; sign-ins post `login.new_location` or `login.success`. |
|
|
463
|
+
| Session details | One "Not available" row instead of score, VPN and proxy. |
|
|
464
|
+
|
|
465
|
+
#### Set up a risk data source
|
|
466
|
+
|
|
467
|
+
Configuration › Location data › **Risk data (VPN, proxy, Tor)** downloads one of two local MaxMind databases with the MaxMind credentials of the Provider and database card. The license key never reaches the browser, and lookups stay on your server: no IP address is sent anywhere.
|
|
468
|
+
|
|
469
|
+
| Database | MaxMind edition | Cost | What it detects |
|
|
470
|
+
| ------------------- | --------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
471
|
+
| GeoIP2 Anonymous IP | `GeoIP2-Anonymous-IP` | Paid; the download fails with "MaxMind refused the download…" if your account does not include it | VPN (`isAnonymousVpn`), public and residential proxies, Tor exit nodes, hosting providers ([MaxMind docs](https://dev.maxmind.com/geoip/docs/databases/anonymous-ip/)). An address that is not in the database is a real "clean" answer. |
|
|
472
|
+
| GeoLite2 ASN | `GeoLite2-ASN` | Free | Only a **heuristic**: a sign-in from a short list of large hosting and cloud networks (AWS, Google Cloud, Azure, DigitalOcean, Hetzner, OVHcloud, Linode, Vultr, Contabo, Oracle Cloud, Alibaba, Scaleway, Leaseweb, IONOS, Hostinger, M247) counts as a hosting network. It does not detect VPNs, proxies or Tor. Used only without the Anonymous IP database; with both, ASN adds the network name. |
|
|
473
|
+
|
|
474
|
+
The CLI updater downloads them too: `MAXMIND_EDITION_ID=GeoIP2-Anonymous-IP npx strapi-magic-sessionmanager-geoip` or `MAXMIND_EDITION_ID=GeoLite2-ASN …`. Each instance reads its own files, like the location database.
|
|
475
|
+
|
|
476
|
+
What the risk data does:
|
|
477
|
+
|
|
478
|
+
| Signal | Score effect | Reject suspicious sign-ins | Suspicious-sign-in email and `login.suspicious` | VPN or proxy email |
|
|
479
|
+
| ---------------------------------------------------- | ------------ | -------------------------------------------------------------- | ----------------------------------------------- | ------------------ |
|
|
480
|
+
| Tor exit node | −50 | Refused (`tor_exit_node`) | Yes | No |
|
|
481
|
+
| VPN | −20 | Refused (`vpn_detected`) | Yes | Yes |
|
|
482
|
+
| Public or residential proxy | −15 | Refused (`proxy_detected`) | Yes | Yes |
|
|
483
|
+
| Hosting network (Anonymous IP or ASN heuristic) | −20 | Not refused, because servers and CI jobs sign in from them too | Yes | No |
|
|
484
|
+
| Any anonymiser (`isAnonymous`) | −10 | Through the score only | Through the score | No |
|
|
485
|
+
| Score below 50 / below 70 (with Security scoring on) | | Refused below 50 | Yes below 70 | |
|
|
486
|
+
|
|
487
|
+
Lookup results keep the field names of earlier versions (`isVpn`, `isProxy`, `isThreat`, `securityScore`, `riskLevel`) and add `isTor`, `isHosting`, `isAnonymous`, `isPublicProxy`, `isResidentialProxy` and `riskSource` (`'anonymous-ip'`, `'asn-heuristic'` or `null`). `isThreat` stays `false`: MaxMind's Anonymous IP data has no threat category.
|
|
488
|
+
|
|
489
|
+
#### Upgrading from 4.14 or earlier
|
|
490
|
+
|
|
491
|
+
Saved settings are not changed: a switch that was on stays stored and applies once a source exists. Check the switches before you download a risk database: a saved "Reject suspicious sign-ins" starts refusing VPN, proxy and Tor sign-ins as soon as the file is present. One rule still depends on the saved "Reject suspicious sign-ins" value: with `geoLookupFailureMode: 'auto'`, a sign-in whose location cannot be determined is rejected while that value is on, exactly as before. The Login protection tab says so; choose **Allow sign-in** under **If the location cannot be determined** to change it.
|
|
492
|
+
|
|
446
493
|
---
|
|
447
494
|
|
|
448
495
|
## Login protection
|
|
@@ -452,7 +499,7 @@ Configuration › Login protection checks **new sign-ins only**. Existing sessio
|
|
|
452
499
|
| Rule | Response | Notes |
|
|
453
500
|
| ----------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
454
501
|
| Temporary IP lockout | 429 with `Retry-After` | After `maxFailedLogins` failed sign-ins from one IP address within 15 minutes, that address is refused for 15 minutes. User accounts are not blocked. Shared by all server processes. Each attempt is counted before the password check, so a parallel burst cannot exceed the limit; when more attempts from one address are running at once than the limit, the extra ones get 429 with `Retry-After: 1` and no lock. |
|
|
455
|
-
| Reject suspicious sign-ins | 403 | VPN, proxy or
|
|
502
|
+
| Reject suspicious sign-ins | 403 | VPN, proxy or Tor address, or, with security scoring on, a score below 50. Needs a [risk data source](#risk-data-vpn-proxy-tor); without one this rule refuses nothing. |
|
|
456
503
|
| Country rules | 403 | Allow only listed countries, or reject listed countries. With "Allow only listed countries", an empty list allows every country. |
|
|
457
504
|
| Location cannot be determined | 403 "Login temporarily unavailable" | When `geoLookupFailureMode` says reject (`auto` rejects only when "Reject suspicious sign-ins" is on). |
|
|
458
505
|
|
|
@@ -464,8 +511,8 @@ Requests with an ended session get **401** with the header `X-Session-Terminated
|
|
|
464
511
|
|
|
465
512
|
Configuration › Alerts. Both kinds are sent only when location data is available for the sign-in.
|
|
466
513
|
|
|
467
|
-
- **Security emails to users** go to the end user's own email address, not to administrators: suspicious sign-in, sign-in from a new country (differs from the user's last 50 sessions), VPN or proxy. They use Strapi's Email plugin, so configure an email provider first (for example `@strapi/provider-email-nodemailer`).
|
|
468
|
-
- **Team notifications** post every sign-in to Discord or Slack as `login.suspicious`, otherwise `login.new_location`, otherwise `login.success`. Only `https://discord.com`, `https://discordapp.com` and `https://hooks.slack.com` URLs are accepted; Save rejects any other URL with a field error, and an empty field clears the URL.
|
|
514
|
+
- **Security emails to users** go to the end user's own email address, not to administrators: suspicious sign-in, sign-in from a new country (differs from the user's last 50 sessions), VPN or proxy. Suspicious sign-in and VPN or proxy need a [risk data source](#risk-data-vpn-proxy-tor); the new-country email needs location data only. They use Strapi's Email plugin, so configure an email provider first (for example `@strapi/provider-email-nodemailer`).
|
|
515
|
+
- **Team notifications** post every sign-in to Discord or Slack as `login.suspicious`, otherwise `login.new_location`, otherwise `login.success`. Without a [risk data source](#risk-data-vpn-proxy-tor), `login.suspicious` is never sent. Only `https://discord.com`, `https://discordapp.com` and `https://hooks.slack.com` URLs are accepted; Save rejects any other URL with a field error, and an empty field clears the URL.
|
|
469
516
|
|
|
470
517
|
Example email provider configuration:
|
|
471
518
|
|
|
@@ -638,32 +685,32 @@ The **Admin panel sessions** routes need two more permissions, which only the Su
|
|
|
638
685
|
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
|
|
639
686
|
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
|
|
640
687
|
|
|
641
|
-
| Method | Path | Admin UI action
|
|
642
|
-
| -------- | -------------------------------------------------------------- |
|
|
643
|
-
| GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below
|
|
644
|
-
| GET | `/sessions/active` | Active sessions only; same paging parameters
|
|
645
|
-
| GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process
|
|
646
|
-
| GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise)
|
|
647
|
-
| POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute
|
|
648
|
-
| GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds
|
|
649
|
-
| GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor`
|
|
650
|
-
| GET | `/user/:userId/sessions` | Sessions panel
|
|
651
|
-
| POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays)
|
|
652
|
-
| DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends)
|
|
653
|
-
| POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check)
|
|
654
|
-
| POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`)
|
|
655
|
-
| POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user**
|
|
656
|
-
| GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`)
|
|
657
|
-
| GET | `/geolocation/:ipAddress` | **Look up location**
|
|
658
|
-
| GET | `/geoip/status` | GeoIP database status
|
|
659
|
-
| PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials
|
|
660
|
-
| POST | `/geoip/update` | Update database / Force download
|
|
661
|
-
| GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input)
|
|
662
|
-
| POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging`
|
|
663
|
-
| GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read`
|
|
664
|
-
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read`
|
|
665
|
-
| POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute
|
|
666
|
-
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute
|
|
688
|
+
| Method | Path | Admin UI action |
|
|
689
|
+
| -------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
690
|
+
| GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
|
|
691
|
+
| GET | `/sessions/active` | Active sessions only; same paging parameters |
|
|
692
|
+
| GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
|
|
693
|
+
| GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
|
|
694
|
+
| POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
|
|
695
|
+
| GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
|
|
696
|
+
| GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
|
|
697
|
+
| GET | `/user/:userId/sessions` | Sessions panel |
|
|
698
|
+
| POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
|
|
699
|
+
| DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
|
|
700
|
+
| POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
|
|
701
|
+
| POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
|
|
702
|
+
| POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
|
|
703
|
+
| GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
|
|
704
|
+
| GET | `/geolocation/:ipAddress` | **Look up location** |
|
|
705
|
+
| GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`) |
|
|
706
|
+
| PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
|
|
707
|
+
| 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…" |
|
|
708
|
+
| GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input) |
|
|
709
|
+
| POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
|
|
710
|
+
| GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
|
|
711
|
+
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
|
|
712
|
+
| 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
|
+
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
667
714
|
|
|
668
715
|
**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.
|
|
669
716
|
|
|
@@ -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-CNSJITRX.js");
|
|
13
13
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -7,7 +7,7 @@ import styled from "styled-components";
|
|
|
7
7
|
import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
|
|
8
8
|
import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
|
|
9
9
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
|
-
import { 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-lnZBc5n0.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,8 @@ const designSystem = require("@strapi/design-system");
|
|
|
9
9
|
const icons = require("@strapi/icons");
|
|
10
10
|
const symbols = require("@strapi/icons/symbols");
|
|
11
11
|
const styled = require("styled-components");
|
|
12
|
-
const index = require("./index-
|
|
12
|
+
const index = require("./index-CNSJITRX.js");
|
|
13
|
+
const riskData = require("./riskData-BVs9GpgD.js");
|
|
13
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
15
16
|
const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
|
|
@@ -305,16 +306,19 @@ function normalizeGeoData(geo, fallback = {}) {
|
|
|
305
306
|
const city = index.presentText(geo.city);
|
|
306
307
|
const timezone = index.presentText(geo.timezone);
|
|
307
308
|
if (!country && !city && !timezone) return null;
|
|
309
|
+
const riskSource = riskData.isRiskSource(geo.riskSource) ? geo.riskSource : null;
|
|
308
310
|
const rawScore = typeof geo.securityScore === "number" ? geo.securityScore : fallback?.securityScore;
|
|
309
|
-
const securityScore = typeof rawScore === "number" && Number.isFinite(rawScore) ? rawScore : null;
|
|
311
|
+
const securityScore = riskSource && typeof rawScore === "number" && Number.isFinite(rawScore) ? rawScore : null;
|
|
310
312
|
return {
|
|
311
313
|
country,
|
|
312
314
|
city,
|
|
313
315
|
timezone,
|
|
316
|
+
riskSource,
|
|
314
317
|
securityScore,
|
|
315
|
-
riskLevel: normalizeRiskLevel(geo.riskLevel),
|
|
316
|
-
isVpn: booleanOrNull(geo.isVpn),
|
|
317
|
-
isProxy: booleanOrNull(geo.isProxy)
|
|
318
|
+
riskLevel: riskSource ? normalizeRiskLevel(geo.riskLevel) : "",
|
|
319
|
+
isVpn: riskSource === "anonymous-ip" ? booleanOrNull(geo.isVpn) : null,
|
|
320
|
+
isProxy: riskSource === "anonymous-ip" ? booleanOrNull(geo.isProxy) : null,
|
|
321
|
+
isHosting: riskSource ? booleanOrNull(geo.isHosting) : null
|
|
318
322
|
};
|
|
319
323
|
}
|
|
320
324
|
function getStoredGeoData(session) {
|
|
@@ -332,6 +336,7 @@ function getStoredGeoData(session) {
|
|
|
332
336
|
riskLevel: _ignoredLevel,
|
|
333
337
|
isVpn: _ignoredVpn,
|
|
334
338
|
isProxy: _ignoredProxy,
|
|
339
|
+
isHosting: _ignoredHosting,
|
|
335
340
|
...facts
|
|
336
341
|
} = geoLocation;
|
|
337
342
|
return normalizeGeoData(facts, { securityScore: session?.securityScore });
|
|
@@ -575,27 +580,42 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
|
|
|
575
580
|
};
|
|
576
581
|
const yesNoText = (value) => typeof value === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: value ? t("common.yes", "Yes") : t("common.no", "No") }) : void 0;
|
|
577
582
|
const notStoredForPast = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t("modal.security.notStored", "Not stored for past sign-ins") });
|
|
578
|
-
const score = typeof geo?.securityScore === "number" ? geo.securityScore :
|
|
579
|
-
const
|
|
583
|
+
const score = typeof geo?.securityScore === "number" ? geo.securityScore : null;
|
|
584
|
+
const riskUnavailable = Boolean(geo) && !geo.riskSource;
|
|
585
|
+
const riskMessage = liveGeo?.riskSource ? RISK_LEVEL_MESSAGES[liveGeo.riskLevel] : null;
|
|
586
|
+
const notAvailable = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t("modal.security.riskUnavailable", "Not available") });
|
|
580
587
|
const locationItems = [
|
|
581
588
|
{ id: "country", label: t("modal.security.country", "Country"), value: geo?.country },
|
|
582
589
|
{ id: "city", label: t("modal.security.city", "City"), value: geo?.city },
|
|
583
590
|
{ id: "timezone", label: t("modal.security.timezone", "Time zone"), value: geo?.timezone },
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
591
|
+
...riskUnavailable ? [
|
|
592
|
+
{
|
|
593
|
+
id: "riskData",
|
|
594
|
+
label: t("modal.security.riskData", "VPN, proxy and security score"),
|
|
595
|
+
render: notAvailable
|
|
596
|
+
}
|
|
597
|
+
] : [
|
|
598
|
+
{
|
|
599
|
+
id: "score",
|
|
600
|
+
label: t("modal.security.score", "Security score"),
|
|
601
|
+
value: score === null ? null : t("modal.security.scoreValue", "{score}/100", { score })
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
id: "vpn",
|
|
605
|
+
label: t("modal.security.vpn", "VPN"),
|
|
606
|
+
render: liveGeo ? yesNoText(liveGeo.isVpn) ?? notAvailable : storedGeo ? notStoredForPast : void 0
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
id: "proxy",
|
|
610
|
+
label: t("modal.security.proxy", "Proxy"),
|
|
611
|
+
render: liveGeo ? yesNoText(liveGeo.isProxy) ?? notAvailable : storedGeo ? notStoredForPast : void 0
|
|
612
|
+
},
|
|
613
|
+
liveGeo ? {
|
|
614
|
+
id: "hosting",
|
|
615
|
+
label: t("modal.security.hosting", "Hosting network"),
|
|
616
|
+
render: yesNoText(liveGeo.isHosting)
|
|
617
|
+
} : null
|
|
618
|
+
],
|
|
599
619
|
riskMessage ? {
|
|
600
620
|
id: "risk",
|
|
601
621
|
label: t("modal.security.riskLevel", "Risk level"),
|
|
@@ -714,10 +734,23 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
|
|
|
714
734
|
) }),
|
|
715
735
|
/* @__PURE__ */ jsxRuntime.jsxs(DetailSection, { title: t("modal.section.security", "Location and security"), children: [
|
|
716
736
|
hasLocationData ? /* @__PURE__ */ jsxRuntime.jsx(index.PropertyList, { items: locationItems }) : null,
|
|
717
|
-
score !== null ? /* @__PURE__ */ jsxRuntime.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
737
|
+
score !== null ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", "data-score-note": "", children: [
|
|
738
|
+
t(
|
|
739
|
+
"modal.security.scoreNote",
|
|
740
|
+
"Higher is safer. Below 70 can trigger a suspicious-sign-in email and below 50 a rejection, if those settings are on."
|
|
741
|
+
),
|
|
742
|
+
geo?.riskSource === "asn-heuristic" ? ` ${t(
|
|
743
|
+
"modal.security.asnHeuristicNote",
|
|
744
|
+
"From the ASN heuristic: it only recognises large hosting and cloud networks, not VPNs, proxies or Tor."
|
|
745
|
+
)}` : null
|
|
746
|
+
] }) : null,
|
|
747
|
+
riskUnavailable ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-risk-unavailable": "", children: [
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
|
|
749
|
+
"modal.security.riskUnavailableNote",
|
|
750
|
+
"Needs a risk data source. Location data alone cannot tell VPNs, proxies or Tor apart, so no score was calculated."
|
|
751
|
+
) }),
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(TargetLink, { tag: reactRouterDom.NavLink, to: riskData.RISK_SETTINGS_PATH, children: t("modal.security.riskSetup", "Set up risk data") })
|
|
753
|
+
] }) : null,
|
|
721
754
|
lookupControls
|
|
722
755
|
] }),
|
|
723
756
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { collapsible: true, size: "S", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: "technical", children: [
|