Skip to content

[P1] [security] kill_process has no self-protection — can kill own admin connection #433

Closed

Description

@EVWorth

[P1] [security] kill_process lacks self-protection guard — user can kill the connection the admin panel is running on

Context

api.killProcess(connectionId, processId) is invoked with the same connectionId the admin tab is using. processes rows include the pool's own connection.

Problem

Per docs/audits/admin.md F5.

A user who clicks the skull next to their own connection ID gets a KILL confirmation; the KILL succeeds; pool auto-acquires a different connection; next fetchProcesses resolves... but if user kills the LAST connection, the pool exhausts and the panel shows "Failed to kill process: pool timed out" without telling them they killed themselves. No PROCESS privilege check — SELECT-only users see processes (visible to all since MySQL 5.7) but their KILL fails with ERROR 1095 (HY000): You are not owner of thread.

Files

  • src/components/admin/AdminPanel.tsx:108-116
  • src-tauri/crates/mas-admin/src/lib.rs:96-122

Repro (if applicable)

Static analysis only.

Expected

Click kill next to admin's own connection ID → tooltip "Cannot kill your own connection" and button disabled. Click kill on another user's connection works. SELECT-only privilege → clear "PROCESS privilege required" message.

Proposed fix

Scope M. (a) Filter own connection from process list, or show visually distinct (greyed, no kill button). (b) Catch "not owner of thread" in kill_process and convert to clearer message.

Acceptance

Own connection is non-killable; other users' connections are; SELECT-only user sees clear privilege message.

Needs human verify

Yes

Labels: audit, area/admin, severity/p1, kind/security

Activity

  1. added
    audit
    severity/p1
    kind/security
    area/admin
    on Jul 31, 2026
  2. EVWorth commented on Aug 29, 2026

    @EVWorth
    OwnerAuthor

    Done in #522. The pool records each server thread it opens in after_connect, kill_process refuses those, and the UI disables the button with an explanatory tooltip rather than letting the click fail. ERROR 1095 is translated into a message naming the missing privilege. Integration tests confirm the app's own threads are refused, the connection still works after the refusal, and a connection opened outside the pool is still killable — so the guard is not a blanket refusal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adminauditkind/securityseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions