Skip to content

Fix mysql.db_remove system-database guard checking a misspelled name#69688

Open
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-54938-mysql-information-schema-typo
Open

Fix mysql.db_remove system-database guard checking a misspelled name#69688
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-54938-mysql-information-schema-typo

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

db_remove() in salt/modules/mysql.py guarded the system databases by comparing the name against the misspelled "information_scheme", so the guard never matched and the real information_schema database was not protected from a DROP. Changed the literal on line 1367 to "information_schema". Added test_db_remove_system_db which mocks db_exists=True and asserts db_remove returns False and never calls _connect for "mysql" and "information_schema"; verified it fails on the unpatched code and passes with the fix.

What issues does this PR fix or reference?

Fixes #54938

Previous Behavior

See #54938.

New Behavior

Fix mysql.db_remove system-database guard checking a misspelled name. Validated by a unit test proven to fail on unpatched 3006.x and pass with the fix (confirmed by adversarial review).

Merge requirements satisfied?

  • Tests written/updated
  • Changelog

Commits signed with GPG?

No

The system-database guard in db_remove compared the name against the
misspelled "information_scheme", so the check never matched and the real
information_schema database was not protected from removal.

Fixes saltstack#54938
…tabase guard

The direct test verifies db_remove issues DROP DATABASE for a user database literally named information_scheme (the misspelling formerly stuck in the guard), called with just the database name and empty connection_args exactly as the production caller mysql_database.absent() does; it fails when the source fix is reverted. The inverse test guards against overcorrection by asserting databases whose names merely resemble the protected system databases (mysql_backup, information_schema_old) are still dropped, and passes with and without the fix.

Claude-Session: https://claude.ai/code/session_01MF2AuQNhBZg4HDt1x6xxCu
@dwoz dwoz added the test:full Run the full test suite label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants