strapi-plugin-magic-sessionmanager 4.16.0 → 4.16.1
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 +38 -0
- package/README.md +42 -28
- package/dist/admin/{Analytics-me4qzS0I.js → Analytics-CMR62DiD.js} +1 -1
- package/dist/admin/{Analytics-D4gsVwL0.mjs → Analytics-FcRt0X62.mjs} +1 -1
- package/dist/admin/{App-BTG-2Q26.js → App-CmytGbze.js} +80 -15
- package/dist/admin/{App-BJwtFWxl.mjs → App-DBieSWB0.mjs} +80 -15
- package/dist/admin/{OnlineUsersWidget-DYS3Vy1Q.js → OnlineUsersWidget-Lzx9XB74.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-Yd283YDy.mjs → OnlineUsersWidget-zP9Hl_it.mjs} +1 -1
- package/dist/admin/{Settings-TPZ9_75s.js → Settings-1v--SXC0.js} +185 -54
- package/dist/admin/{Settings-DIlvfdjZ.mjs → Settings-CZOPusQK.mjs} +185 -54
- package/dist/admin/{de-DB9ldYwN.mjs → de-D3TSA066.mjs} +17 -3
- package/dist/admin/{de-BuMw1gBJ.js → de-y_9mdVT7.js} +17 -3
- package/dist/admin/{en-BbLMPQB3.mjs → en-B60I97bK.mjs} +17 -3
- package/dist/admin/{en-BqGhOJDy.js → en-CIQB8nfI.js} +17 -3
- package/dist/admin/{es-C5iaiE9G.mjs → es-CJEL_iGC.mjs} +17 -3
- package/dist/admin/{es-BaIeckl9.js → es-DHhHzlRY.js} +17 -3
- package/dist/admin/{fr-BEvBUCwI.mjs → fr-BfBK_iuV.mjs} +17 -3
- package/dist/admin/{fr-D1YKyTex.js → fr-D86FTt1w.js} +17 -3
- package/dist/admin/{index-CgZiLcJ1.js → index-CSJJn4qy.js} +15 -10
- package/dist/admin/{index-DUESEUaO.mjs → index-tt61o2VH.mjs} +15 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-DtnW-s0V.js → pt-BE-FT-L8.js} +17 -3
- package/dist/admin/{pt-DeDih9cR.mjs → pt-C3PSvC7z.mjs} +17 -3
- package/dist/server/index.js +2643 -1800
- package/dist/server/index.mjs +2643 -1800
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
## [4.16.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.16.0...v4.16.1) (2026-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* harden admin tracking (geo opt-in, failed sign-in flood, title and email exposure, protected settings, webhook secrets, proxy IP, hidden types) ([#38](https://github.com/Schero94/Magic-Sessionmanager/issues/38)) ([22b6705](https://github.com/Schero94/Magic-Sessionmanager/commit/22b670531a77bdefcbf1654c137d112e8eb3dd98))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Release type: minor (`fix` commits for the security review of admin tracking, one `feat` for the new permission **Change protected settings**). Routes, paths and request bodies stay the same; the response and permission changes below close the review findings and are listed with what to do.
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
|
|
13
|
+
* **F1, location lookup of admin addresses.** With the default settings, 4.15 and 4.16 sent the full IP address of every admin sign-in, failed attempt and lockout to ipapi.co. The security log now looks up locations only when **Look up the location of security events** (`securityLogGeoLookup`, new, **off** by default) is on, then only the anonymised address (/24, /48), and only in the local GeoIP database unless `ipapi` is chosen explicitly as provider (no fallback from `auto` to ipapi.co). Special-purpose addresses are recognised with `net.BlockList` against the IANA registries (IPv4 and IPv6: private, loopback, link-local, CGNAT, documentation including `2001:db8::/32` and `3fff::/20`, benchmarking, multicast, reserved), so they are never looked up for sessions either. Changing the location lookup settings needs the new permission.
|
|
14
|
+
* **F2, failed sign-in floods.** Failed sign-ins of unknown accounts are counted per anonymised address and 5 minutes into one row (`meta.count`; the API adds `attempts` to sign-in rows). Each address stores at most 30 failed-sign-in and lockout rows per hour, further attempts are counted. When the queue is full, failed sign-ins are dropped first, then Content Manager views, then other activity, with a log line per family. User agents are cut to 256 characters (was 500).
|
|
15
|
+
* **F3, entry titles.** Content Manager activity no longer stores the entry title (nor keeps the entry in the queue: only type, document id and locale). Lists and exports resolve titles when they are read, with the reader's own Content Manager permissions (type, conditions, field-level for the main field); deleted entries have none. A one-time, idempotent start-up migration removes `meta.title` from stored events.
|
|
16
|
+
* **F4, admin identities.** `GET /admin-sessions/admins` and `…/admins/:adminId/sessions` return names and emails only to callers who also hold `admin::users.read`, and role names only with `admin::users.read` or `admin::roles.read`; otherwise they are empty and `search` matches the admin id only. The same applies to admin names in the sign-in history and activity. `meta.identity` says what was visible. Your own row is always complete.
|
|
17
|
+
* **F5, settings changes.** New permission `plugin::magic-sessionmanager.settings.update` ("Change protected settings", Super Admin by default) for location lookup, webhooks and the security log settings. Every settings change records an always-on `settings.updated` event with the admin and the changed key names (never values); every retention run that deletes events records `security-log.retention.purged` with the counts. The security log retention is at least 7 days.
|
|
18
|
+
* **F6, webhook URLs.** `GET /settings` and the `PUT` response no longer contain `discordWebhookUrl` / `slackWebhookUrl`, but `hasDiscordWebhook`, `hasSlackWebhook` and a hint without the secret part (`https://discord.com/…`). A `PUT` without the URL keeps it, an empty string removes it. The Configuration page shows **Saved** with **Replace** and **Remove**.
|
|
19
|
+
* **F7, spoofable client IP.** Start-up warns when `server.proxy.koa` is on and `server.proxy.maxIpsCount` is unset or 0. When the client IP and the TCP peer differ, the log also keeps the anonymised peer in `meta.socketIp`.
|
|
20
|
+
* **F8, internal tables.** The Content Manager admin API answers 404 for the plugin's content types (also for roles granted `explorer.*` on them), and GraphQL Shadow CRUD is turned off for them when `@strapi/plugin-graphql` is installed.
|
|
21
|
+
* **Hardening.** A sign-out deletes the browser's Strapi session records once more about a second later (a racing token renewal cannot leave a record behind). The admin session list returns an opaque handle as `id` instead of Strapi's `sessionId` (a claim of the admin access token); sign-out accepts the handle and still a raw session id. CSV exports also neutralise formulas after leading zero-width or other invisible characters and full-width `= + - @`. Reads of the sign-in history and activity with an admin API token record `security-log.read` (once per token and list per 5 minutes).
|
|
22
|
+
|
|
23
|
+
### Migration
|
|
24
|
+
|
|
25
|
+
* **Roles that changed settings with `access` only** keep saving the Configuration page and every unprotected setting. To let such a role change location lookup, webhooks or (with **View admin activity**) the security log settings, grant **Change protected settings** in Settings › Administration Panel › Roles › Plugins › Session Manager › Settings. API clients get 403 with `error.details.reason: "settings-update-permission"` until then. This keeps every unprotected setting API-stable; requiring the new permission for every key would have locked existing roles out of the whole page.
|
|
26
|
+
* **Roles with "View admin activity" that changed the security log settings** also need **Change protected settings** now.
|
|
27
|
+
* **Roles with "Read admin panel sessions" or "View admin activity"** that should keep seeing admin names, emails and roles need Strapi's **Read** on Users (`admin::users.read`), or **Read** on Roles for role names only.
|
|
28
|
+
* **Scripts reading webhook URLs from `GET /settings`** must keep them elsewhere; use `hasDiscordWebhook` / `hasSlackWebhook` to check whether one is stored. Scripts that send the whole `GET` response back keep the stored URLs (the keys are no longer in it).
|
|
29
|
+
* **Location of admin sign-ins**: to keep seeing country and city, turn on **Look up the location of security events** and provide a local GeoIP database (or choose `ipapi` explicitly).
|
|
30
|
+
* **Security log retention below 7 days** (possible in 4.15 and 4.16) is raised to 7 at the first start, with a log line.
|
|
31
|
+
* **Stored entry titles** are removed from `meta` at the first start (bounded batches; the daily retention job finishes large logs). Nothing to do.
|
|
32
|
+
* **Behind a proxy**, set `server.proxy.maxIpsCount` if the new start-up warning appears.
|
|
33
|
+
|
|
34
|
+
### Tests
|
|
35
|
+
|
|
36
|
+
* Real-HTTP suite `tests/isolated-admin-activity-http.test.js` covers every finding on Strapi (SQLite and, new in CI, PostgreSQL): title resolution with and without Content Manager rights and field-level permissions, the title migration, a 150-email flood, identity masking and id-only search, opaque session handles, protected settings, the `settings.updated` and retention events, the retention minimum and its migration, webhook masking, and 404 for the Content Manager routes of the plugin types.
|
|
37
|
+
* Unit tests for the queue drop order, aggregation and per-address cap, opt-in location lookup (no ipapi.co request with the defaults), special-purpose ranges, the proxy warning, the Content Manager guard, GraphQL Shadow CRUD, the migrations, the repeated sign-out, token-read auditing and CSV escaping; a StrictMode render test for the webhook field and the read-only protected controls.
|
|
38
|
+
|
|
1
39
|
# [4.16.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.15.0...v4.16.0) (2026-11-24)
|
|
2
40
|
|
|
3
41
|
|
package/README.md
CHANGED
|
@@ -395,7 +395,7 @@ Static defaults from `server/src/config/index.js`; admin units and ranges from t
|
|
|
395
395
|
| `enableEmailAlerts` | `false` | boolean | Alerts | Security emails to users. |
|
|
396
396
|
| `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). |
|
|
397
397
|
| `enableWebhooks` | `false` | boolean | Alerts | Team notifications. |
|
|
398
|
-
| `discordWebhookUrl` / `slackWebhookUrl` | `''` | https URL on discord.com / discordapp.com, or hooks.slack.com | Alerts | Any other host is rejected.
|
|
398
|
+
| `discordWebhookUrl` / `slackWebhookUrl` | `''` | https URL on discord.com / discordapp.com, or hooks.slack.com | Alerts | Any other host is rejected. Write-only since 4.17: never returned, see Team notifications. |
|
|
399
399
|
| `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. |
|
|
400
400
|
| `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. |
|
|
401
401
|
| `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. |
|
|
@@ -516,7 +516,7 @@ Requests with an ended session get **401** with the header `X-Session-Terminated
|
|
|
516
516
|
Configuration › Alerts. Both kinds are sent only when location data is available for the sign-in.
|
|
517
517
|
|
|
518
518
|
- **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`).
|
|
519
|
-
- **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
|
|
519
|
+
- **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. A webhook URL is a secret (anyone with it can post to the channel), so since 4.17 it is never sent back to the browser: a stored URL shows as **Saved** with the host (`https://discord.com/…`) and **Replace** / **Remove**. Over the API, `GET /settings` returns `hasDiscordWebhook` / `hasSlackWebhook` and `discordWebhookHint` / `slackWebhookHint` instead of the URLs; a `PUT` without the URL key keeps the stored URL, an empty string removes it. Changing webhooks needs **Change protected settings**.
|
|
520
520
|
|
|
521
521
|
Example email provider configuration:
|
|
522
522
|
|
|
@@ -684,11 +684,16 @@ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authe
|
|
|
684
684
|
|
|
685
685
|
The **Admin panel sessions** routes need two more permissions, which only the Super Admin role has by default (Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel):
|
|
686
686
|
|
|
687
|
-
| Permission | Name in the role editor
|
|
688
|
-
| ---------------------------------------------------- |
|
|
689
|
-
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions
|
|
690
|
-
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins
|
|
691
|
-
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity
|
|
687
|
+
| Permission | Name in the role editor | Allows |
|
|
688
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
689
|
+
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
|
|
690
|
+
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
|
|
691
|
+
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent sign-in activity, CSV exports and changing the Admin activity settings (also needs read) |
|
|
692
|
+
| `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
|
|
693
|
+
|
|
694
|
+
**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.
|
|
695
|
+
|
|
696
|
+
**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` and every security log key (those also keep needing **View admin activity**, reason `admin-activity-permission`). 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.
|
|
692
697
|
|
|
693
698
|
| Method | Path | Admin UI action |
|
|
694
699
|
| -------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -710,9 +715,9 @@ The **Admin panel sessions** routes need two more permissions, which only the Su
|
|
|
710
715
|
| GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`) |
|
|
711
716
|
| PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
|
|
712
717
|
| 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…" |
|
|
713
|
-
| GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input)
|
|
718
|
+
| 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 |
|
|
714
719
|
| POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
|
|
715
|
-
| 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`
|
|
720
|
+
| 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` |
|
|
716
721
|
| GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
|
|
717
722
|
| POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
718
723
|
| POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
|
|
@@ -729,9 +734,9 @@ The list, statistics, analytics, export, untracked-session summary and `/users/s
|
|
|
729
734
|
|
|
730
735
|
**Block / unblock** (`toggle-block`): send `{ "blocked": true }` or `{ "blocked": false }`. This sets the state, is safe to retry and is what the admin UI sends. A request without a body still toggles, but is deprecated, because a retry after a lost response can reverse the intended state. A non-boolean `blocked` returns 400. The response contains `blocked` and `mode` (`explicit` or `toggle`). Blocking ends all open sessions with the reason `blocked`; if that fails, the response is 500 and the request can be retried.
|
|
731
736
|
|
|
732
|
-
**Admin panel sessions.** `GET /admin-sessions/admins` returns `{ data: [{ id, name, email, roles: [{ name, superAdmin }], account, self, sessionCount, lastActiveAt, canSignOut, protectedReason }], meta: { supported, pagination, stats: { signedInAdmins, activeSessions, activeAccounts, totalAdmins }, policy, truncated } }`. `account` is `active`, `deactivated` or `invited`. `GET …/sessions` returns `{ data: [{ id, device, signedInAt, lastActiveAt, endsAt, rememberMe, current }], meta: { admin, policy } }`; `id` is
|
|
737
|
+
**Admin panel sessions.** `GET /admin-sessions/admins` returns `{ data: [{ id, name, email, roles: [{ name, superAdmin }], account, self, sessionCount, lastActiveAt, canSignOut, protectedReason }], meta: { supported, pagination, stats: { signedInAdmins, activeSessions, activeAccounts, totalAdmins }, policy, truncated, recording, identity: { names, emails, roles } } }`. `account` is `active`, `deactivated` or `invited`. `name` and `email` are empty strings and `roles` is empty when the caller may not see them (see above; `meta.identity`). `GET …/sessions` returns `{ data: [{ id, device, signedInAt, lastActiveAt, endsAt, rememberMe, current }], meta: { admin, policy } }`; since 4.17 `id` is an opaque handle of the browser's newest session record (32 hexadecimal characters, a SHA-256 of Strapi's `sessionId`, which is a claim of the admin's access token and is no longer returned). The sign-out route accepts the handle, and still a raw Strapi session id. No token, refresh token, device id or password field is ever returned. Both sign-out routes return `{ data: { ended, signedOutSelf } }`: `signedOutSelf` is `true` when the browser that sent the request was signed out. Answers: 404 for an unknown admin, and for a session id that is not a live session of that admin (no probing of other admins' sessions); 403 with `error.details.reason` `super-admin-protected` when an admin without the Super Admin role tries to sign out a Super Admin, or `browser-session-required` for admin API tokens; 429 after 10 sign-outs per minute per admin; 503 when the Strapi version has no session manager (`meta.supported: false` on the GET routes). Each sign-out writes one log line, `[magic-sessionmanager] Admin sign-out: actor=<admin id> target=<admin id> scope=one|all ended=<n>`, at info level (no email, session id or token), and emits the Strapi event `magic-sessionmanager.admin-sessions.signed-out` with the same fields.
|
|
733
738
|
|
|
734
|
-
**How a sign-out works (Strapi 5.62).** The plugin deletes Strapi's own session records of that browser (`strapi.sessionManager('admin').invalidateRefreshToken(adminId, deviceId)`, the same call Strapi's logout makes) or of every browser (`invalidateRefreshToken(adminId)`). Strapi's admin authentication checks the session record on every admin request (`isSessionActive`), so the admin's next request returns 401 and the admin panel cannot renew its token: it shows the login page. There is no waiting period for the 30-minute access token (`accessTokenLifespan`). The plugin deletes every record of the browser, not only the newest one: an older access token belongs to an older, rotated record, and deleting just the newest record (`revokeSessionById`) would leave that token working until it expires. The integration suite proves both. Admin API tokens (Settings › Admin tokens) are separate from sessions and are not affected.
|
|
739
|
+
**How a sign-out works (Strapi 5.62).** The plugin deletes Strapi's own session records of that browser (`strapi.sessionManager('admin').invalidateRefreshToken(adminId, deviceId)`, the same call Strapi's logout makes) or of every browser (`invalidateRefreshToken(adminId)`). Strapi's admin authentication checks the session record on every admin request (`isSessionActive`), so the admin's next request returns 401 and the admin panel cannot renew its token: it shows the login page. There is no waiting period for the 30-minute access token (`accessTokenLifespan`). About a second later the plugin runs the same delete once more, so a token renewal that raced the sign-out (Strapi reads the old record, then writes the new one) cannot leave a new record behind. The plugin deletes every record of the browser, not only the newest one: an older access token belongs to an older, rotated record, and deleting just the newest record (`revokeSessionById`) would leave that token working until it expires. The integration suite proves both. Admin API tokens (Settings › Admin tokens) are separate from sessions and are not affected.
|
|
735
740
|
|
|
736
741
|
Errors use Strapi's `{ data: null, error }` envelope: 400 for invalid input, 404 for unknown IDs, 500 for server-side failures, 502 for a failed MaxMind download, 409 for a settings save based on an outdated `revision`.
|
|
737
742
|
|
|
@@ -741,12 +746,17 @@ Errors use Strapi's `{ data: null, error }` envelope: 400 for invalid input, 404
|
|
|
741
746
|
|
|
742
747
|
Since 4.15 the plugin keeps a **security log**: one table (`plugin::magic-sessionmanager.security-event`, collection `magic_sessions_security_events`, hidden from the Content Manager and the Content-Type Builder) where every event has an actor (`actorType` `admin`/`user`/`system`, `actorId`), a target (`targetType`, `targetId`), an `event` name, `ip`, `userAgent`, `geo`, a small `meta` object (at most 16 plain values, 2 KB) and `createdAt`. It is indexed on actor, target, event and time. The admin panel uses it for two things:
|
|
743
748
|
|
|
744
|
-
| Recorded
|
|
745
|
-
|
|
|
746
|
-
| **Admin sign-in history**
|
|
747
|
-
| **Content Manager activity**
|
|
749
|
+
| Recorded | Events | Default |
|
|
750
|
+
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
751
|
+
| **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 |
|
|
752
|
+
| **Content Manager activity** | `admin.content.view` (opening an entry), `.create`, `.update`, `.publish`, `.unpublish`, `.discard`, `.delete`, `.clone`, with content type, document id and locale | **Off** |
|
|
753
|
+
| **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 |
|
|
754
|
+
|
|
755
|
+
**Entry titles (4.17).** The log stores no entry title or other content of an entry. The Activity list and its export look the title up when they are read, with the reader's own Content Manager permissions: the reader must be allowed to read the content type and its main field (field-level permissions and conditions such as "is creator" apply). Otherwise, and for deleted entries, the row shows the document id. Titles stored by 4.15 and 4.16 are removed once at start-up.
|
|
748
756
|
|
|
749
|
-
**Who can see it.** The new permission **View admin activity** (`plugin::magic-sessionmanager.admin-activity.read`, together with `access` and `admin-sessions.read`). Only the Super Admin role has it until you grant it in Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel.
|
|
757
|
+
**Who can see it.** The new permission **View admin activity** (`plugin::magic-sessionmanager.admin-activity.read`, together with `access` and `admin-sessions.read`). Only the Super Admin role has it until you grant it in Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel. Changing the settings below needs it **and** **Change protected settings** (`settings.update`, 4.17); other admins can still save the Configuration page, but not change these values (403). Admin names in the history need `admin::users.read`, as in the Admin panel view.
|
|
758
|
+
|
|
759
|
+
**Not reachable elsewhere (4.17).** The plugin's tables are internal. The Content Manager admin API answers 404 for them (also for roles that were granted Content Manager permissions on them), and when `@strapi/plugin-graphql` is installed, GraphQL Shadow CRUD is turned off for them, so they are not in the schema.
|
|
750
760
|
|
|
751
761
|
### How events are captured (Strapi 5.63)
|
|
752
762
|
|
|
@@ -756,7 +766,8 @@ Since 4.15 the plugin keeps a **security log**: one table (`plugin::magic-sessio
|
|
|
756
766
|
- **Registration and password reset** create a session without an event; a small server middleware records them as sign-ins.
|
|
757
767
|
- **Content Manager activity** is recorded by the same middleware after the Content Manager has answered: only successful calls of a signed-in admin to the entry routes (`collection-types` findOne, create, update, publish, unpublish, discard, delete, clone and bulk actions, and the single-type routes). List views, counts, relations and configuration calls are not activity. Opening the same entry (same admin, content type, document and locale) again within 10 minutes, or right after editing it, is one event.
|
|
758
768
|
- The request behind an event is read from Strapi's request context (`strapi.requestContext`), which is how the IP address and user agent reach the event hub listeners.
|
|
759
|
-
- Nothing is written on the request path. Events go to a bounded in-memory queue and are written in batches about once a second; GeoIP lookups also happen there. The settings are read when the batch is written, so a switched-off recording drops queued events.
|
|
769
|
+
- Nothing is written on the request path. Events go to a bounded in-memory queue and are written in batches about once a second; GeoIP lookups (if turned on) also happen there. The settings are read when the batch is written, so a switched-off recording drops queued events.
|
|
770
|
+
- **Floods (4.17).** Failed sign-ins of unknown accounts (an email that is not an admin; Strapi's login rate limit counts per email and address, so changing the email gets around it) are counted per anonymised address and 5 minutes into one row (`meta.count`, shown as "N attempts within 5 minutes"). Each address stores at most 30 failed-sign-in and lockout rows per hour; further attempts are counted into that row. User agents are cut to 256 characters. If the queue (2,000 events) is full, failed sign-ins are dropped first, then Content Manager views, then other activity; sign-ins, sign-outs and settings changes last. The log line names how many events of each kind were dropped.
|
|
760
771
|
|
|
761
772
|
### Client IP address and reverse proxies
|
|
762
773
|
|
|
@@ -773,19 +784,22 @@ module.exports = ({ env }) => ({
|
|
|
773
784
|
});
|
|
774
785
|
```
|
|
775
786
|
|
|
776
|
-
Without `proxy.koa` every event shows the proxy's address. The integration suite runs once without and once with a trusted proxy (`ADMIN_ACTIVITY_PROXY=1`) and checks both.
|
|
787
|
+
Without `proxy.koa` every event shows the proxy's address. With `proxy.koa: true` and no `maxIpsCount` (or 0), Koa takes the left-most `X-Forwarded-For` entry, which the client chooses: the plugin logs a warning at start-up (4.17). When the client IP and the TCP peer differ, the log also keeps the peer, anonymised, in `meta.socketIp`, so a spoofed address can be told apart. The integration suite runs once without and once with a trusted proxy (`ADMIN_ACTIVITY_PROXY=1`) and checks both.
|
|
777
788
|
|
|
778
789
|
### Settings (Configuration › Admin activity)
|
|
779
790
|
|
|
780
|
-
| Setting | Key | Default | Notes
|
|
781
|
-
| --------------------------------------- | -------------------------- | ------- |
|
|
782
|
-
| Record admin sign-ins | `adminSignInHistory` | On | Sign-ins, failures, lockouts, sign-outs, who signed out whom.
|
|
783
|
-
| Record Content Manager activity | `adminContentActivity` | **Off** | Records how people work; read the notes below before you turn it on.
|
|
784
|
-
| Store IP addresses | `securityLogStoreIp` | On | Applies to the whole security log.
|
|
785
|
-
| Anonymise the last part of IP addresses | `securityLogAnonymizeIp` | Off | Stores `203.0.113.0` instead of `203.0.113.42`; IPv6 keeps the first 48 bits.
|
|
786
|
-
|
|
|
791
|
+
| Setting | Key | Default | Notes |
|
|
792
|
+
| --------------------------------------- | -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
793
|
+
| Record admin sign-ins | `adminSignInHistory` | On | Sign-ins, failures, lockouts, sign-outs, who signed out whom. |
|
|
794
|
+
| Record Content Manager activity | `adminContentActivity` | **Off** | Records how people work; read the notes below before you turn it on. |
|
|
795
|
+
| Store IP addresses | `securityLogStoreIp` | On | Applies to the whole security log. |
|
|
796
|
+
| Anonymise the last part of IP addresses | `securityLogAnonymizeIp` | Off | Stores `203.0.113.0` instead of `203.0.113.42`; IPv6 keeps the first 48 bits. |
|
|
797
|
+
| Look up the location of security events | `securityLogGeoLookup` | **Off** | 4.17. Only the anonymised address is looked up, in the local GeoIP database; ipapi.co only when you chose `ipapi` as provider. Before 4.17 the full address went to ipapi.co by default. |
|
|
798
|
+
| Keep security events for | `securityLogRetentionDays` | 90 days | 7-730 (the minimum was 1 before 4.17; lower stored values are raised to 7 at start-up). A daily job (03:17 server time, one process per cluster) deletes older events and records how many. |
|
|
799
|
+
|
|
800
|
+
All keys in this table are protected settings: changing them needs **View admin activity** and **Change protected settings**. Every settings change is recorded as `settings.updated` with the admin and the key names.
|
|
787
801
|
|
|
788
|
-
When an admin account is deleted, the plugin deletes the events of that admin (sign-ins, failures, activity). Where that admin had signed someone else out, the
|
|
802
|
+
When an admin account is deleted, the plugin deletes the events of that admin (sign-ins, failures, activity). Where that admin had signed someone else out, changed settings or read the log with a token, the event stays and only the actor reference is cleared. The same clean-up runs daily for accounts deleted while the plugin was not running.
|
|
789
803
|
|
|
790
804
|
### Legal notes (information, not legal advice)
|
|
791
805
|
|
|
@@ -793,7 +807,7 @@ These notes describe what the feature does so you can check it with your data pr
|
|
|
793
807
|
|
|
794
808
|
- **GDPR.** Sign-in history with IP addresses is personal data of your admins. A typical basis is a legitimate interest in securing the admin panel (Art. 6(1)(f) GDPR) or, for employees, the national employment rules. Tell your admins about it in your privacy information (Art. 13), keep the retention as short as your security needs allow, and consider **Anonymise the last part of IP addresses**. An admin's events can be exported as CSV for an access request (Art. 15) and are deleted with the account.
|
|
795
809
|
- **Content Manager activity.** This records what each person works on and when. In Germany, a technical system that can monitor the behaviour or performance of employees is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist in other countries. That is why it is off by default; inform the people concerned and, where there is one, agree it with the works council before you turn it on. Check whether a data protection impact assessment (Art. 35 GDPR) is needed.
|
|
796
|
-
- **Third parties.**
|
|
810
|
+
- **Third parties.** Since 4.17 no admin address leaves the server by default: **Look up the location of security events** is off, and when it is on, only the anonymised address is looked up in the local database (ipapi.co only with the explicit `ipapi` provider). For end-user sessions, the `auto` or `ipapi` provider can still send IP addresses to ipapi.co; use a local MaxMind database or turn off the IP location lookup to keep them on your server. Special-purpose addresses (private, loopback, link-local, CGNAT, documentation, benchmarking, multicast and reserved ranges, IPv4 and IPv6) are never looked up.
|
|
797
811
|
|
|
798
812
|
### Performance
|
|
799
813
|
|
|
@@ -989,7 +1003,7 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
989
1003
|
- **Revocation.** Ended, expired and revoked sessions and blocked users are rejected on every Content API request, in both token check modes. Tokens of deleted records stay on a revocation list.
|
|
990
1004
|
- **Password reset.** A successful password reset ends every older session of the user in both JWT modes.
|
|
991
1005
|
- **Privacy.** Session records contain IP addresses, user agents and location data. With the `auto` or `ipapi` provider, IP addresses can be sent to ipapi.co; use `local-mmdb` or turn off IP location lookup to avoid that. The details dialog never looks up a location unless you click **Look up location**. Set **Keep ended sessions for** to match your retention policy, and use **Delete ended sessions** or **Delete record** to remove history.
|
|
992
|
-
- **What leaves your server.** Only what you turn on: IP lookups at ipapi.co (provider `auto` without a local database, or `ipapi`), Discord or Slack webhooks (Team notifications), emails through your own Email provider (Security emails) and the MaxMind database download when you click **Update database** or run the updater. There is no telemetry, no install ping and no license check.
|
|
1006
|
+
- **What leaves your server.** Only what you turn on: IP lookups of end-user sign-ins at ipapi.co (provider `auto` without a local database, or `ipapi`; admin security events only with **Look up the location of security events** and the explicit `ipapi` provider, and then only the anonymised address), Discord or Slack webhooks (Team notifications), emails through your own Email provider (Security emails) and the MaxMind database download when you click **Update database** or run the updater. There is no telemetry, no install ping and no license check.
|
|
993
1007
|
- **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.
|
|
994
1008
|
- **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.
|
|
995
1009
|
- **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.
|
|
@@ -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-CSJJn4qy.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-tt61o2VH.mjs";
|
|
11
11
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
12
12
|
const ANALYTICS_UNKNOWN_KEY = "unknown";
|
|
13
13
|
const VERSION_TOKEN = /^v?\d[\w.]*$/i;
|
|
@@ -9,7 +9,7 @@ const 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-CSJJn4qy.js");
|
|
13
13
|
const riskData = require("./riskData-BVs9GpgD.js");
|
|
14
14
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
15
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
@@ -111,7 +111,7 @@ const CSV_HEADERS = Object.freeze([
|
|
|
111
111
|
"Minutes Idle",
|
|
112
112
|
"End Reason"
|
|
113
113
|
]);
|
|
114
|
-
const FORMULA_START = /^[=+\-@\t\r]/;
|
|
114
|
+
const FORMULA_START = /^[\s\u00ad\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
115
115
|
const escapeCsvValue = (value) => {
|
|
116
116
|
const text = String(value ?? "");
|
|
117
117
|
const safe = typeof value === "string" && FORMULA_START.test(text) ? `'${text}` : text;
|
|
@@ -2561,6 +2561,25 @@ function getSignOutErrorMessage(error) {
|
|
|
2561
2561
|
defaultMessage: "The admin could not be signed out. Try again."
|
|
2562
2562
|
};
|
|
2563
2563
|
}
|
|
2564
|
+
function withIdentityPlaceholders(admin, placeholderName, identity) {
|
|
2565
|
+
if (!admin || typeof admin !== "object") return admin;
|
|
2566
|
+
const hidden = !admin.self && !admin.name;
|
|
2567
|
+
return {
|
|
2568
|
+
...admin,
|
|
2569
|
+
name: admin.name || placeholderName(admin.id),
|
|
2570
|
+
identityHidden: hidden,
|
|
2571
|
+
rolesHidden: hidden && identity?.roles === false
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
function withEventAdminNames(row, placeholderName) {
|
|
2575
|
+
if (!row || typeof row !== "object") return row;
|
|
2576
|
+
const fill = (admin) => admin && typeof admin === "object" && !admin.name ? { ...admin, name: placeholderName(admin.id), identityHidden: true } : admin;
|
|
2577
|
+
return {
|
|
2578
|
+
...row,
|
|
2579
|
+
...row.admin !== void 0 ? { admin: fill(row.admin) } : {},
|
|
2580
|
+
...row.actor !== void 0 ? { actor: fill(row.actor) } : {}
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2564
2583
|
const HIGHLIGHT_BADGE = { backgroundColor: "primary100", textColor: "neutral800" };
|
|
2565
2584
|
const keepActionKeys = (event) => {
|
|
2566
2585
|
if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
@@ -2588,13 +2607,13 @@ const AdminIdentity = ({ admin }) => {
|
|
|
2588
2607
|
),
|
|
2589
2608
|
admin.self ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...HIGHLIGHT_BADGE, shrink: 0, children: t("adminPanel.you", "You") }) : null
|
|
2590
2609
|
] }),
|
|
2591
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, title: admin.email, children: admin.email })
|
|
2610
|
+
admin.identityHidden ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("adminPanel.identity.emailHidden", "Email hidden (needs “Read” on Users)") }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, title: admin.email, children: admin.email })
|
|
2592
2611
|
] });
|
|
2593
2612
|
};
|
|
2594
2613
|
const AdminRoles = ({ admin }) => {
|
|
2595
2614
|
const t = useT$3();
|
|
2596
2615
|
const names = (admin.roles || []).map((role) => role.name).filter(Boolean);
|
|
2597
|
-
const text = names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
|
|
2616
|
+
const text = admin.rolesHidden ? t("adminPanel.roles.hidden", "Hidden (needs “Read” on Roles)") : names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
|
|
2598
2617
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", ellipsis: true, title: text, children: text });
|
|
2599
2618
|
};
|
|
2600
2619
|
const AdminStatus = ({ admin }) => {
|
|
@@ -3018,6 +3037,15 @@ const SignInEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
|
|
|
3018
3037
|
}
|
|
3019
3038
|
if (row.actor)
|
|
3020
3039
|
facts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
|
|
3040
|
+
if (Number.isInteger(row.attempts) && row.attempts > 1) {
|
|
3041
|
+
facts.push(
|
|
3042
|
+
t(
|
|
3043
|
+
"adminPanel.activity.attempts",
|
|
3044
|
+
"{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
|
|
3045
|
+
{ count: row.attempts }
|
|
3046
|
+
)
|
|
3047
|
+
);
|
|
3048
|
+
}
|
|
3021
3049
|
return /* @__PURE__ */ jsxRuntime.jsxs(EventItem, { id: row.id, kind: event.key, children: [
|
|
3022
3050
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
|
|
3023
3051
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
|
|
@@ -3067,6 +3095,22 @@ const ActivityEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
|
|
|
3067
3095
|
};
|
|
3068
3096
|
function useEventList({ path, params, logKey }) {
|
|
3069
3097
|
const { get } = StrapiAdmin.useFetchClient();
|
|
3098
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
3099
|
+
const fillNames = react.useCallback(
|
|
3100
|
+
(list) => list.map(
|
|
3101
|
+
(row) => withEventAdminNames(
|
|
3102
|
+
row,
|
|
3103
|
+
(id) => formatMessage(
|
|
3104
|
+
{
|
|
3105
|
+
id: index.getTranslation("adminPanel.identity.placeholder"),
|
|
3106
|
+
defaultMessage: "Admin #{id}"
|
|
3107
|
+
},
|
|
3108
|
+
{ id }
|
|
3109
|
+
)
|
|
3110
|
+
)
|
|
3111
|
+
),
|
|
3112
|
+
[formatMessage]
|
|
3113
|
+
);
|
|
3070
3114
|
const [rows, setRows] = react.useState([]);
|
|
3071
3115
|
const [meta, setMeta] = react.useState(null);
|
|
3072
3116
|
const [page, setPage] = react.useState(1);
|
|
@@ -3085,7 +3129,7 @@ function useEventList({ path, params, logKey }) {
|
|
|
3085
3129
|
const response = await get(path, { params: { ...JSON.parse(key), page: nextPage } });
|
|
3086
3130
|
if (requestId !== requestRef.current) return;
|
|
3087
3131
|
const body = response?.data || {};
|
|
3088
|
-
const data = Array.isArray(body.data) ? body.data : [];
|
|
3132
|
+
const data = fillNames(Array.isArray(body.data) ? body.data : []);
|
|
3089
3133
|
setRows((current) => nextPage === 1 ? data : [...current, ...data]);
|
|
3090
3134
|
setMeta(body.meta || null);
|
|
3091
3135
|
setPage(nextPage);
|
|
@@ -3101,7 +3145,7 @@ function useEventList({ path, params, logKey }) {
|
|
|
3101
3145
|
}
|
|
3102
3146
|
}
|
|
3103
3147
|
},
|
|
3104
|
-
[get, path, key, logKey]
|
|
3148
|
+
[get, path, key, logKey, fillNames]
|
|
3105
3149
|
);
|
|
3106
3150
|
react.useEffect(() => {
|
|
3107
3151
|
load(1);
|
|
@@ -3120,14 +3164,14 @@ function useEventList({ path, params, logKey }) {
|
|
|
3120
3164
|
});
|
|
3121
3165
|
const body = response?.data || {};
|
|
3122
3166
|
if (!Array.isArray(body.data)) throw new Error("Invalid export response");
|
|
3123
|
-
all.push(...body.data);
|
|
3167
|
+
all.push(...fillNames(body.data));
|
|
3124
3168
|
cursor = typeof body.meta?.nextCursor === "string" ? body.meta.nextCursor : null;
|
|
3125
3169
|
} while (cursor && all.length < MAX_EVENT_EXPORT_ROWS);
|
|
3126
3170
|
return {
|
|
3127
3171
|
rows: all.slice(0, MAX_EVENT_EXPORT_ROWS),
|
|
3128
3172
|
capped: all.length > MAX_EVENT_EXPORT_ROWS || Boolean(cursor)
|
|
3129
3173
|
};
|
|
3130
|
-
}, [get, path, key]);
|
|
3174
|
+
}, [get, path, key, fillNames]);
|
|
3131
3175
|
return {
|
|
3132
3176
|
rows,
|
|
3133
3177
|
meta,
|
|
@@ -3585,8 +3629,8 @@ const AdminSessionsModal = ({
|
|
|
3585
3629
|
{
|
|
3586
3630
|
id: "email",
|
|
3587
3631
|
label: t("adminPanel.dialog.email", "Email"),
|
|
3588
|
-
value: admin.email,
|
|
3589
|
-
kind: "email"
|
|
3632
|
+
value: admin.identityHidden ? t("adminPanel.identity.emailHidden", "Email hidden (needs “Read” on Users)") : admin.email,
|
|
3633
|
+
kind: admin.identityHidden ? void 0 : "email"
|
|
3590
3634
|
},
|
|
3591
3635
|
{
|
|
3592
3636
|
id: "roles",
|
|
@@ -3734,7 +3778,15 @@ const AdminPanelPage = () => {
|
|
|
3734
3778
|
const response = await get(`/${index.pluginId}/admin-sessions/admins`, { params: listParams });
|
|
3735
3779
|
if (requestId !== requestIdRef.current) return;
|
|
3736
3780
|
const body = response?.data || {};
|
|
3737
|
-
|
|
3781
|
+
const placeholder = (id) => formatMessage(
|
|
3782
|
+
{ id: index.getTranslation("adminPanel.identity.placeholder"), defaultMessage: "Admin #{id}" },
|
|
3783
|
+
{ id }
|
|
3784
|
+
);
|
|
3785
|
+
setAdmins(
|
|
3786
|
+
(Array.isArray(body.data) ? body.data : []).map(
|
|
3787
|
+
(row) => withIdentityPlaceholders(row, placeholder, body.meta?.identity)
|
|
3788
|
+
)
|
|
3789
|
+
);
|
|
3738
3790
|
setMeta(body.meta || null);
|
|
3739
3791
|
setLoadError(false);
|
|
3740
3792
|
hasLoadedRef.current = true;
|
|
@@ -3748,7 +3800,7 @@ const AdminPanelPage = () => {
|
|
|
3748
3800
|
setRefreshing(false);
|
|
3749
3801
|
}
|
|
3750
3802
|
}
|
|
3751
|
-
}, [get, listParams]);
|
|
3803
|
+
}, [get, listParams, formatMessage]);
|
|
3752
3804
|
react.useEffect(() => {
|
|
3753
3805
|
fetchAdmins();
|
|
3754
3806
|
}, [fetchAdmins]);
|
|
@@ -3762,7 +3814,20 @@ const AdminPanelPage = () => {
|
|
|
3762
3814
|
if (requestId !== dialogRequestRef.current) return;
|
|
3763
3815
|
const body = response?.data || {};
|
|
3764
3816
|
setDialogSessions(Array.isArray(body.data) ? body.data : []);
|
|
3765
|
-
if (body.meta?.admin)
|
|
3817
|
+
if (body.meta?.admin) {
|
|
3818
|
+
const placeholder = (id) => formatMessage(
|
|
3819
|
+
{
|
|
3820
|
+
id: index.getTranslation("adminPanel.identity.placeholder"),
|
|
3821
|
+
defaultMessage: "Admin #{id}"
|
|
3822
|
+
},
|
|
3823
|
+
{ id }
|
|
3824
|
+
);
|
|
3825
|
+
setSelected(
|
|
3826
|
+
(current) => current ? withIdentityPlaceholders(body.meta.admin, placeholder, {
|
|
3827
|
+
roles: current.rolesHidden ? false : void 0
|
|
3828
|
+
}) : current
|
|
3829
|
+
);
|
|
3830
|
+
}
|
|
3766
3831
|
setDialogError(false);
|
|
3767
3832
|
} catch (err) {
|
|
3768
3833
|
if (requestId !== dialogRequestRef.current || index.isCancelledRequest(err)) return;
|
|
@@ -3772,7 +3837,7 @@ const AdminPanelPage = () => {
|
|
|
3772
3837
|
if (requestId === dialogRequestRef.current) setDialogLoading(false);
|
|
3773
3838
|
}
|
|
3774
3839
|
},
|
|
3775
|
-
[get]
|
|
3840
|
+
[get, formatMessage]
|
|
3776
3841
|
);
|
|
3777
3842
|
const openDialog = (admin, trigger, tab = "sessions") => {
|
|
3778
3843
|
openerRef.current = trigger;
|
|
@@ -4057,7 +4122,7 @@ const AdminPanelPage = () => {
|
|
|
4057
4122
|
value: view.search,
|
|
4058
4123
|
onSearch: handleSearch,
|
|
4059
4124
|
label: t("adminPanel.search.label", "Search admins"),
|
|
4060
|
-
placeholder: t("adminPanel.search.placeholder", "Search name or email")
|
|
4125
|
+
placeholder: meta?.identity?.names === false ? t("adminPanel.search.placeholderId", "Search by admin ID") : t("adminPanel.search.placeholder", "Search name or email")
|
|
4061
4126
|
}
|
|
4062
4127
|
) }),
|
|
4063
4128
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", shrink: 0, children: [
|