You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: server error text leaks passwords into the log #881
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
fix: strip echoed SQL from logged server errors
fix: credential follow-ups from the log redaction (#885)