strapi-plugin-magic-sessionmanager 4.22.0 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +163 -119
- package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
- package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
- package/dist/admin/{Analytics-WbCUmkQQ.mjs → Analytics-DGAHD19E.mjs} +1 -1
- package/dist/admin/{Analytics-DeDLGiCe.js → Analytics-_WA68oHb.js} +1 -1
- package/dist/admin/{App-Bkv-W0Sv.js → App-CfhAQ17e.js} +304 -104
- package/dist/admin/{App-C4bihk2K.mjs → App-VB66H73A.mjs} +276 -76
- package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
- package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
- package/dist/admin/{OnlineUsersWidget-q0Z6nbbO.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CSvNe2rC.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
- package/dist/admin/{Settings-xokFI5LO.js → Settings-BBs2FDp7.js} +87 -266
- package/dist/admin/{Settings-avD0DbXP.mjs → Settings-CKDNGJhl.mjs} +79 -258
- package/dist/admin/{de-BQlEdBMr.mjs → de-CK-HuY41.mjs} +48 -7
- package/dist/admin/{de-HcJ19LKI.js → de-CSRQPn6F.js} +48 -7
- package/dist/admin/{en-DI-98CPM.js → en-DCtAgGEa.js} +48 -7
- package/dist/admin/{en-DzuXWL1W.mjs → en-KZ5ajaAR.mjs} +48 -7
- package/dist/admin/{es-BfyED9YI.mjs → es-B7k8taWV.mjs} +48 -7
- package/dist/admin/{es-Cm0Eklav.js → es-CKT00l4K.js} +48 -7
- package/dist/admin/{fr-C3nzszsI.js → fr-B2EdBFSb.js} +48 -7
- package/dist/admin/{fr-CzFNGWq0.mjs → fr-Q2gmYqCn.mjs} +48 -7
- package/dist/admin/{index-6zc5D8eb.mjs → index-BPbs1GyP.mjs} +386 -61
- package/dist/admin/{index-Dk5Jqe5U.js → index-Cho0XGZ1.js} +340 -15
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BPZ6chPT.js → pt-CcMUcqDy.js} +48 -7
- package/dist/admin/{pt-DmyQnGI_.mjs → pt-CmxZTaf2.mjs} +48 -7
- package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
- package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
- package/dist/server/index.js +1809 -400
- package/dist/server/index.mjs +1809 -400
- package/package.json +9 -4
- package/dist/admin/dashboardModel-BBNRgcEr.mjs +0 -170
- package/dist/admin/dashboardModel-D4389iIV.js +0 -169
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
+
# [4.23.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.22.1...v4.23.0) (2026-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* sign in as another admin in an isolated tab, read-only by default, with audit and version guard ([#47](https://github.com/Schero94/Magic-Sessionmanager/issues/47)) ([16915a5](https://github.com/Schero94/Magic-Sessionmanager/commit/16915a51aaa607a9e1ac30c356e5153ecc67fe51))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Release type: minor (`feat`). Adds **Sign in as another admin**: a real admin session of another admin in a separate browser tab, read-only unless changes are allowed. No breaking change: the 4.21 permission preview stays, under the new name **View permissions**.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **Sign in as another admin.** Session Manager › Admin panel › row action **Sign in as** (key icon). The dialog asks for a reason, 15 or 30 minutes and **Allow changes** (off by default, with a warning that changes show as made by the other admin). **Open tab signed in as …** opens a new tab with that admin's menu and permissions and a bar on every page: who, read-only or changes allowed, time left, **End impersonation**. The starting admin's other tabs stay signed in as themselves.
|
|
14
|
+
* New permission **Sign in as another admin** (`plugin::magic-sessionmanager.impersonate.admins.sign-in`). The Super Admin role holds it automatically; other roles only when granted. The **Allow impersonation** switch must be on.
|
|
15
|
+
* The server creates the session with `strapi.sessionManager('admin').generateRefreshToken` on its own device id (`msm-admin-impersonation-…`), marks it in the session metadata, lets it expire with the impersonation and keeps the refresh token on the server. A one-time code (60 seconds, single use, only for the starting admin) in the URL fragment hands it to the new tab.
|
|
16
|
+
* Read-only by default: a server middleware refuses every non-GET admin request of the session (403 `impersonation-read-only`), except Strapi's read-only permission check. Never allowed, even with **Allow changes**: the other admin's account, password and sessions, admin users, roles, API and transfer tokens, SSO providers, sign-in and password routes and every change route of this plugin (403 `impersonation-identity`).
|
|
17
|
+
* `POST /admin/logout` from the impersonation tab ends only the impersonation; Strapi's logout (which without a device id deletes every session of the signed-in admin) never runs for the other admin.
|
|
18
|
+
* Ending: the bar, **Active impersonations** (now also on the Admin panel page), Strapi's **Log out** in the tab, signing out in the starting admin's own tab, the switch, or the end of the duration. Only the impersonation's own session is deleted.
|
|
19
|
+
* Attribution: every allowed change is recorded as `impersonation.write` with the real admin as actor and `meta.impersonating`, `meta.method`, `meta.route` and `meta.status`; refused requests as `impersonation.refused` (`call-read-only`, `call-identity`). New filter **Impersonation** in the admin sign-in history.
|
|
20
|
+
* Version guard: enabled only on the Strapi releases it was tested against (5.50 to 5.64). On any other release **Sign in as** is disabled with the reason and the server answers 403 `unsupported`. `GET /impersonation/status` reports `adminSignIn: { supported, version, reason, durations }`.
|
|
21
|
+
* New routes: `POST /impersonation/admins/:adminId/sign-in`, `POST /admin-impersonation/exchange`, `GET /admin-impersonation/self`, `POST /admin-impersonation/self/end`. `GET /impersonation/active` rows carry `allowChanges`; `handoff` can be `admin-session`.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
* "View as admin" is now **View permissions** (row action, dialog title "Permissions of …", permission display name "View admin permissions (read-only preview)"). Same permission id, route and behaviour.
|
|
26
|
+
|
|
27
|
+
### Migration
|
|
28
|
+
|
|
29
|
+
* Nothing to do. The impersonation table gets the `allowChanges` column (default false); Strapi adds it at start-up.
|
|
30
|
+
* To use the feature, grant **Sign in as another admin** to the roles that need it (Super Admin has it). With **Allow changes**, Strapi's own "Last edited by", history and audit log show the other admin as the author; the plugin's security log is the record of who really made the change. Agree its use with your works council where one exists (see README › Impersonation).
|
|
31
|
+
|
|
32
|
+
## [4.22.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.22.0...v4.22.1) (2026-11-25)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* second security review (GraphQL mutations while impersonating, socket-based client IP, lockout via auth callback, success resets only the account counter, smaller fixes) ([#45](https://github.com/Schero94/Magic-Sessionmanager/issues/45)) ([c208702](https://github.com/Schero94/Magic-Sessionmanager/commit/c2087025d098ab1c64022123af2caaa477307953))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Release type: patch (`fix`). Fixes every finding of the second security review of 4.21.0 (two High, two Medium, five Low, eight hardening items). The settings API stays compatible: `trustedProxies: true` is still accepted. Read the migration notes: three settings now need **Change protected settings**, `trustedProxies: true` no longer reads proxy headers, and a `SESSION_ENCRYPTION_KEY` shorter than 32 bytes now logs an error at every start (it still starts; the next major version will refuse it).
|
|
41
|
+
|
|
42
|
+
### Security
|
|
43
|
+
|
|
44
|
+
* **H1: impersonation restrictions now cover GraphQL.** Strapi's body parser skips the GraphQL endpoint and Apollo's persisted queries send only a hash, so the request guard never saw GraphQL operations: an impersonating admin could change the user's email with `updateUsersPermissionsUser` and then reset the password. The plugin now adds an Apollo Server plugin to `plugin::graphql.apolloServer.plugins` (next to the host's own plugins) that refuses **every mutation** of an impersonated request in `didResolveOperation`, after Apollo has resolved the operation. This covers aliases, fragments, persisted queries and batched requests. The answer is 403 with `errors[0].extensions.code` `FORBIDDEN` and `extensions.error.details.reason` `impersonation-mutation`, recorded as `impersonation.refused` (`call-mutation`). Queries still work.
|
|
45
|
+
* **H2: the client IP no longer comes from client-set headers.** With `server.proxy.koa` on, or the `trustedProxies` switch on, the plugin read `CF-Connecting-IP`, `True-Client-IP`, `X-Real-IP` or the left-most `X-Forwarded-For` entry. It ignored `maxIpsCount` and `ipHeader`. So any client could bypass the IP lockout, pass country rules and forge stored addresses. The plugin now uses Koa's `ctx.request.ip`, which follows `server.proxy.koa`, `ipHeader` and `maxIpsCount`, and the custom header chain is gone. `trustedProxies` becomes a list of proxy addresses or CIDR ranges (up to 50): only a request whose TCP peer is on the list has its `X-Forwarded-For` read, and the client is the right-most entry that is not on the list. The admin UI shows it as a text field ("Trusted proxies") instead of the switch.
|
|
46
|
+
* **H2: `trustedProxies` and `maxFailedLogins` need Change protected settings.** Before, an admin with plugin access only could turn on proxy trust or raise the IP threshold.
|
|
47
|
+
* **M1 and L2: the lockout counts every sign-in path, and only wrong passwords.** The lockout matched the exact path `POST /api/auth/local`, so `/api/auth/local/`, `/API/auth/local` and the GraphQL `login` mutation still accepted guesses while an address was locked. It now runs inside Users & Permissions' `auth.callback` controller, which every spelling and GraphQL call. The controller is wrapped in the plugin's `register` phase, before Strapi builds the router. Only Users & Permissions' "Invalid identifier or password" counts. Refusals by the session limit, country rules, a blocked or unconfirmed account no longer count, so a shared office address is not locked by them. Magic Link routes keep the path check, which now also normalises case and slashes, and counts only 400 and 401 answers.
|
|
48
|
+
* **Hardening 3: the pre-sign-in location check covers every path too.** It runs in `auth.callback`, `register`, `resetPassword` and `emailConfirmation`, including the GraphQL mutations, and the path check normalises case and slashes.
|
|
49
|
+
* **M2: a successful sign-in no longer resets the address counter.** It cleared both counters, so an attacker could guess 4 times, sign in to their own account, and repeat without limit. A success now clears only the account counter and gives back its own reserved attempt on the address.
|
|
50
|
+
* **L1: the account lockout can no longer lock the owner out of their usual places.** Trusted addresses are no longer counted or refused by the account counter either. A sign-in from a known device (the app's `deviceId` of an earlier sign-in of that account) passes an account lock. The lock email goes out at most once per account per window, using a counter shared by all processes.
|
|
51
|
+
* **L3: the data export no longer shows the internal impersonation reason or the admin id.** `GET /my-data` showed impersonation events with `meta.reason` and `meta.startedBy`. They now show "An administrator opened your account" (ended: "The administrator access to your account ended"; refused: "An administrator access to your account was refused"), the time and the duration only. The reason stays in the admin log and in the optional email, and the dialog hint now says so.
|
|
52
|
+
* **L4: "View as admin" no longer reveals which admin ids are Super Admins.** Without `admin::users.read`, a Super Admin target answers the same 404 as an unknown id. The refusal is still logged as `super-admin`.
|
|
53
|
+
* **L5: the "This wasn't me" token stays out of access logs.** New emails carry the token in the URL fragment (`/not-me#token=…`), which browsers never send to the server. The page copies it into its form with a script allowed by its CSP hash (`script-src 'sha256-…'`). Links with `?token=` from earlier emails keep working until they expire (72 hours).
|
|
54
|
+
* **Hardening 1:** the webhook address check also blocks the IPv4-compatible (`::/96`) and IPv4-translated (`::ffff:0:0:0/96`) IPv6 forms.
|
|
55
|
+
* **Hardening 2:** a webhook delivery now has a 10-second total deadline (`AbortSignal.timeout`). Before, the 5-second idle timeout let a slow receiver hold a delivery for ever.
|
|
56
|
+
* **Hardening 4:** an active impersonation is read on every request instead of being cached for 5 seconds, so ending it on one process takes effect on every process at once.
|
|
57
|
+
* **Hardening 5:** a new signed-webhook URL is saved only together with the secret (400 on `genericWebhookSecret` otherwise), so the stored secret never signs events sent to another host.
|
|
58
|
+
* **Hardening 6:** the alert email templates (`emailTemplates`) need **Change protected settings**. They go to app users from your address, so they could be used for phishing.
|
|
59
|
+
* **Hardening 7:** rate limits and the IP lockout count an IPv6 client per /64.
|
|
60
|
+
* **Hardening 8:** CSV exports also escape a formula after U+061C (Arabic letter mark) and U+180E (Mongolian vowel separator).
|
|
61
|
+
* **Hardening 9:** a `SESSION_ENCRYPTION_KEY` shorter than 32 bytes logs an error at every start, in every environment, and is recorded once per key in the security log as `config.encryption-key.weak` (shown as **Weak encryption key** under Settings and log access, actor System). The key itself is never logged. It is not refused, because a patch release must not stop an installation from starting. **The next major version will refuse to start with a key shorter than 32 bytes.** Unchanged: production refuses to start without a key.
|
|
62
|
+
* **Hardening 10:** a signed-webhook URL whose host is a non-public IP literal (`127.0.0.1`, `0x7f000001`, `[::1]`, `169.254.169.254`, …) is refused when it is saved, not only when it is sent.
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
* The Users & Permissions `auth` controller actions `callback`, `register`, `resetPassword` and `emailConfirmation` are wrapped. A host that overrides them in `src/extensions/users-permissions/strapi-server.js` keeps its override: the plugin wraps the resolved action. The original actions are restored on `destroy`.
|
|
67
|
+
* Development: `@strapi/plugin-graphql` 5.64.0 is a devDependency for the GraphQL tests, and the development host moves to Strapi 5.64.0. The new real-HTTP suite `tests/isolated-security-review2-http.test.js` runs on SQLite and PostgreSQL, in both JWT modes and on the 5.50.0 floor.
|
|
68
|
+
|
|
69
|
+
### Migration
|
|
70
|
+
|
|
71
|
+
* **Behind a reverse proxy:** set `server.proxy: { koa: true, maxIpsCount: <number of proxies> }` in `config/server.js` (Strapi 5.52+), or list your proxies in **Login protection › Client IP address › Trusted proxies** (`trustedProxies: ['10.0.0.0/8']`). Without either, every request shows the proxy's address. On Strapi 5.50 and 5.51 Koa has no `maxIpsCount`; use the `trustedProxies` list there.
|
|
72
|
+
* **`trustedProxies: true`** (switch on, or `true` in `config/plugins.js`) no longer reads proxy headers. A stored `true` is changed to an empty list at start-up, a configured `true` is read as empty, and both log a warning. If you relied on `CF-Connecting-IP` or `X-Real-IP`, configure Koa (`proxy.ipHeader`, `maxIpsCount`) or list the proxy addresses.
|
|
73
|
+
* **Roles with plugin access only** can no longer change `maxFailedLogins`, `trustedProxies` or the email templates (403, `settings-update-permission`). Sending the stored values back still saves the rest of the form. Grant **Change protected settings** to roles that should change them.
|
|
74
|
+
* **`SESSION_ENCRYPTION_KEY` shorter than 32 bytes:** nothing breaks in this release, but every start logs an error, and the next major version will refuse to start. Plan the change before you upgrade to that major: generate a new key (`node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"`) and treat it as a key rotation. Stored encrypted tokens and webhook secrets become unreadable, so users sign in again and the webhook secret must be entered again.
|
|
75
|
+
* **Lockout:** refusals by other rules no longer count as failed sign-ins, and an own successful sign-in no longer clears the address. An address that signs in correctly most of the time but also fails often can now reach the IP threshold sooner. Add office or backend addresses to the trusted addresses.
|
|
76
|
+
* **Account lock:** trusted addresses are no longer refused or counted by the account counter.
|
|
77
|
+
* **Signed webhook:** changing the URL over the API needs `genericWebhookSecret` in the same request. A stored URL with a non-public IP literal is read as empty (it could never be delivered).
|
|
78
|
+
* **GraphQL:** clients that relied on mutations during an impersonation now get 403 `FORBIDDEN`.
|
|
79
|
+
* **"This wasn't me":** if your frontend rewrites or proxies the link, keep the `#token=…` fragment.
|
|
80
|
+
|
|
1
81
|
# [4.22.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.21.0...v4.22.0) (2026-11-25)
|
|
2
82
|
|
|
3
83
|
|