Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/strapi-plugin-maintenance/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Keep Playwright CLI evidence private and value-free. Its accessibility snapshots

Use spec-first development: define acceptance criteria and API response/error contracts before implementation.

Every behavior change starts with a written current-state and target-state analysis covering screens, controls, routes, roles, data, known gaps and non-goals. Define acceptance criteria and API response/error contracts before implementation, then add a failing regression test first. A primary task should take no more than four meaningful user interactions from the plugin entry page; exclude login and mandatory security confirmations, and measure and document any justified exception. Use the Strapi Design System, responsive layouts, keyboard accessibility and explicit loading, empty, success and error states. Enforce authentication, plugin permissions, validation and owner boundaries server-side. Keep API error contracts consistent within each Strapi surface and never return stack traces or internal details. Do not log secrets, tokens, cookies, request bodies, email, IP or stable user/session identifiers. Use fakes for providers and record unverified behavior accurately. Magic Session Manager remains limited to Users & Permissions end-user sessions; Strapi Admin sessions are outside scope.
Every behavior change starts with a written current-state and target-state analysis covering screens, controls, routes, roles, data, known gaps and non-goals. Define acceptance criteria and API response/error contracts before implementation, then add a failing regression test first. A primary task should take no more than four meaningful user interactions from the plugin entry page; exclude login and mandatory security confirmations, and measure and document any justified exception. Use the Strapi Design System, responsive layouts, keyboard accessibility and explicit loading, empty, success and error states. Enforce authentication, plugin permissions, validation and owner boundaries server-side. Keep API error contracts consistent within each Strapi surface and never return stack traces or internal details. Do not log secrets, tokens, cookies, request bodies, email, IP or stable user/session identifiers. Use fakes for providers and record unverified behavior accurately. Magic Session Manager tracks Users & Permissions end-user sessions. Since 4.14 it also shows Strapi admin panel sessions read-only from Strapi's own `admin::session` rows (origin `admin`) and signs admins out through `strapi.sessionManager('admin').invalidateRefreshToken`; never mix admin rows into end-user numbers, never store admin IPs or user agents, and keep the separate `admin-sessions.read` / `admin-sessions.revoke` actions.
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,62 @@ jobs:
MSM_TEST_PG_URL: postgres://strapi:strapi@localhost:5432/magic_sessionmanager_ci
MSM_CONCURRENCY_REQUIRE: sqlite,postgres
run: npm run test:concurrency

admin-sessions:
name: Real Strapi HTTP suites (SQLite + PostgreSQL)
runs-on: ubuntu-latest
timeout-minutes: 20

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
POSTGRES_DB: magic_sessionmanager_http
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '22'
cache: npm

- name: Install dependencies
run: npm ci --legacy-peer-deps

# The suites boot the Strapi version from this repository's devDependencies
# (no separate host app) and fail instead of skipping when it is missing.
- name: Admin panel sessions on SQLite
env:
SESSION_HTTP_REQUIRED: '1'
SESSION_HTTP_STRAPI_NODE_MODULES: ${{ github.workspace }}/node_modules
run: node --test tests/isolated-admin-sessions-http.test.js

- name: Admin panel sessions on PostgreSQL
env:
SESSION_HTTP_REQUIRED: '1'
SESSION_HTTP_STRAPI_NODE_MODULES: ${{ github.workspace }}/node_modules
SESSION_HTTP_DB: postgres
MSM_TEST_PG_URL: postgres://strapi:strapi@localhost:5432/magic_sessionmanager_http
run: node --test tests/isolated-admin-sessions-http.test.js

- name: Existing HTTP access suite (legacy and refresh mode)
env:
SESSION_HTTP_REQUIRED: '1'
SESSION_HTTP_STRAPI_NODE_MODULES: ${{ github.workspace }}/node_modules
run: |
node --test tests/isolated-http-access.test.js
SESSION_HTTP_MODE=refresh node --test tests/isolated-http-access.test.js
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## [Unreleased]

Release type: minor (`feat`), no breaking change. Existing routes, responses, numbers, widgets, settings and Content API features are unchanged. No migration needed.

### Added

* **Admin panel sessions.** A new **Admin panel** view on the Session Manager page (`/admin/plugins/magic-sessionmanager/admin-panel`), next to the app-user dashboard, shows who can use the Strapi admin panel and who is signed in: every admin with roles, status (Signed in, Not signed in, Deactivated, Invited), last activity and the signed-in browsers (Strapi's device label, signed in, last active, latest end, "This browser", "Remember me"). Search, a sign-in status filter and pagination run on the server. All five languages.
* **Sign admins out.** **Sign out** (one browser) and **Sign out everywhere**, each confirmed. Strapi 5.62 checks the admin session on every admin request, so the admin is signed out on their next click and lands on the login page; there is no waiting for the access token to expire. The plugin deletes every Strapi session record of the browser, so older access tokens of rotated records stop working too. Signing yourself out of the current browser shows a warning. **Manage in Settings** links to Strapi's Settings › Users to deactivate an account.
* Admin routes `GET /magic-sessionmanager/admin-sessions/admins`, `GET /magic-sessionmanager/admin-sessions/admins/:adminId/sessions`, `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` and `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sign-out-everywhere` (contracts in the README).
* RBAC actions `plugin::magic-sessionmanager.admin-sessions.read` ("Read admin panel sessions") and `plugin::magic-sessionmanager.admin-sessions.revoke` ("Sign out admins"), granted to Super Admin only by default.

### Security

* Sign-outs need a signed-in administrator (admin API tokens get 403), are limited to 10 per minute per admin, and write one info log line with admin ids and counts only (`[magic-sessionmanager] Admin sign-out: actor=… target=… scope=one|all ended=…`), plus the Strapi event `magic-sessionmanager.admin-sessions.signed-out`.
* An admin without the Super Admin role cannot sign out a Super Admin (403 `super-admin-protected`), so the last active Super Admin can never be signed out by someone else.
* A session id that is not a live session of the given admin answers 404, like an unknown id. Responses never contain tokens, device ids or password fields. The plugin stores nothing about admins; Strapi records no IP address for admin sessions.

### Changed

* Admin session rows (`origin = 'admin'`) stay out of every app-user number; regression tests now cover the dashboard statistics, the untracked-session count and the widget totals with admin sessions present.

### Tests

* Real-HTTP suite `tests/isolated-admin-sessions-http.test.js` on SQLite and PostgreSQL: admins sign in through `POST /admin/login`; listing, sign-out of one browser and everywhere, self sign-out, Super Admin guard, RBAC denials, rate limit, rejected next request and refresh. New CI job runs it, plus the existing HTTP access suite in both JWT modes, against the Strapi 5.62 devDependencies (`@strapi/plugin-users-permissions` is now a devDependency).

## [4.13.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.0...v4.13.1) (2026-11-17)


Expand Down
Loading
Loading