Skip to content

fix: server error text leaks passwords into the log #881

Closed

Description

@EVWorth

This is a follow-up to #875. Redacting the statement text keeps passwords out of the log, but MySQL echoes part of the statement back in its syntax errors. The app logs that error message verbatim.

Reproduce

docker exec mas-mysql-8 mysql -utest_user -ptest_password test_db \
  -e "CREATE USR 'a'@'%' IDENTIFIED BY 'hunter2'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; ... near 'USR 'a'@'%' IDENTIFIED BY 'hunter2'' at line 1

execute_query logs that error with tracing::error!(error = %e, "Query execution failed") (src-tauri/src/commands/mod.rs:279). apply_grid_edits and explain_query do the same. A mistyped CREATE USER from the admin panel therefore writes the password to the file log.

Cause

The quoting in near '…' is unbalanced: the server wraps the statement's tail in quotes, but does not escape the quotes inside it. The credential redactor sees the password outside any literal, so it can't remove it.

Fix

When logging a server error, record the code and sql_state and strip everything from near ' to at line N from the message. Do the same where the error message is stored in query history (frontend src/stores/ history path, and mas-core/src/history). Add a test using the error text above.

Activity

  1. added
    bug
    on Oct 24, 2026
  2. added a commit that references this issue on Oct 24, 2026
    d2d8ddc
  3. added a commit that references this issue on Oct 24, 2026
    4baf1a8
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions