Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 23, 2025

This PR addresses issue #246 regarding special symbols in MySQL database passwords. After thorough investigation, I discovered that the issue has already been resolved in the current codebase.

Investigation Results

The original issue reported that the MySQL connector failed when database passwords contained special symbols like spaces. The suggested fix was to manually add quotes around passwords:

# Original problematic code (from issue description)
cmd += ' --password={}'.format(self.settings['PASSWORD'])

# Suggested fix (from issue description)  
cmd += " --password='{}'".format(self.settings['PASSWORD'])

However, the current implementation already uses a superior approach:

# Current implementation (already fixed)
cmd += f" --password={utils.get_escaped_command_arg(self.settings['PASSWORD'])}"

The utils.get_escaped_command_arg() function wraps Python's shlex.quote(), which properly handles all edge cases including:

  • Passwords with spaces: "my password"'my password'
  • Special characters: "pass!@#$%^&*()" → properly escaped
  • Quotes: "pass'word\"test" → safely quoted to handle internal quotes
  • Shell metacharacters: "pass;word&command" → properly escaped

Changes Made

Since the core issue was already resolved, this PR adds comprehensive test coverage to prevent regression:

  1. Enhanced MySQL connector tests - Added tests for both _create_dump and _restore_dump methods with various special character scenarios
  2. Expanded utils tests - Added comprehensive argument escaping tests for different special character types
  3. End-to-end flow verification - Added test that verifies the complete password handling pipeline from escaping through command parsing

All 270 tests pass, confirming that the current implementation correctly handles passwords with special characters throughout the entire processing flow.

Fixes #246.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Special symbols in passwords Add comprehensive tests for MySQL password special character handling Aug 23, 2025
Copilot AI requested a review from Archmonger August 23, 2025 08:52
@Archmonger Archmonger requested a review from Copilot August 23, 2025 11:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for MySQL password special character handling to prevent regression of issue #246. The investigation revealed that the original issue has already been resolved in the current codebase through proper use of utils.get_escaped_command_arg() which wraps shlex.quote().

Key changes:

  • Added comprehensive test coverage for MySQL connector password handling with special characters
  • Enhanced utils tests for argument escaping with various special character scenarios
  • Added end-to-end flow verification tests to ensure complete password handling pipeline works correctly

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_utils.py Added comprehensive tests for argument escaping with special characters and end-to-end password handling flow
tests/test_connectors/test_mysql.py Added tests for MySQL connector dump and restore operations with special character passwords

@Archmonger Archmonger marked this pull request as ready for review August 24, 2025 01:04
@Archmonger Archmonger merged commit 4829c9e into master Aug 24, 2025
19 checks passed
@Archmonger Archmonger deleted the copilot/fix-246 branch August 24, 2025 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Special symbols in passwords

2 participants