Fix: Skip sandbox line in MariaDB dump files during import#294
Closed
iamsandeepdahiya wants to merge 2 commits intowp-cli:mainfrom
Closed
Fix: Skip sandbox line in MariaDB dump files during import#294iamsandeepdahiya wants to merge 2 commits intowp-cli:mainfrom
iamsandeepdahiya wants to merge 2 commits intowp-cli:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
Member
|
I don't think it should be the responsibility of wp cli to modify these files directly. Also we can't create temporary files of unknown size -- I regularly come across dump files that are many GB. This is very easy to address outside of wp cli if you are importing dump files across incompatible versions of MariaDB (just remove the incompatible line or strip it when exporting). |
This was referenced Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses a compatibility issue introduced by a recent MariaDB security fix (MDEV-21178), which causes
wp db importto fail when importing SQL dump files generated by newer versions of MariaDB.Background
To mitigate a serious security vulnerability, MariaDB added a new "sandbox mode" that disables potentially dangerous client-side commands. This mode is triggered by placing the following directive at the top of a dump file:
/*!999999\ - enable the sandbox mode */While this is safe for newer MariaDB clients, it breaks compatibility with:
This directive causes a SQL syntax error when encountered during import:
ERROR 1064 (42000): You have an error in your SQL syntax...This problem is being tracked in #258.
Solution
This patch introduces a safeguard into the import() method: