Skip to content

fix: re-login and re-send when phpMyAdmin expires the session - #13

Merged
blaipr merged 1 commit into
mainfrom
fix/pma-expired-session
Sep 2, 2026
Merged

blaipr merged 1 commit into
mainfrom
fix/pma-expired-session

Conversation

@blaipr

@blaipr blaipr commented Sep 2, 2026

Copy link
Copy Markdown
Member

What this changes

PhpMyAdminClient.runOne checks each response for the login form (input[name="pma_username"]) before reading it as a result. When it appears, the client clears the session, logs in again and re-sends the statement once; if the login form comes back a second time the statement fails by name (StatementError) instead of being reported as applied. login() now returns the token, and clears stale cookies before starting a new session. docs/phpmyadmin.md records the new selector and the behaviour.

Why

phpMyAdmin drops an idle session after 24 minutes by default and answers the next POST with its login page — status 200, no error, no grid, no affected count, and a token input of its own. An MCP server lives far longer than that, so the first db_execute of the afternoon met this page and was reported as applied with nothing affected, and the login form's token was quietly adopted as the rotated one. Nothing ran — an unauthenticated POST is turned away before it reaches MySQL — so the single retry cannot apply a statement twice. Covered by tests over a scripted fetch; sabotage-checked against the previous client (2 fail).

Checklist

  • npm test passes
  • npm run typecheck passes
  • Documentation in docs/ updated if behaviour changed
  • CHANGELOG.md updated if the change is user-observable
  • No credentials, hostnames or database names in the diff

@blaipr
blaipr force-pushed the fix/pma-expired-session branch from 16a80b3 to 67ab2a5 Compare September 2, 2026 22:07
@blaipr
blaipr merged commit be05eab into main Sep 2, 2026
@blaipr
blaipr deleted the fix/pma-expired-session branch September 2, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant