Fix passphrase quoting in decrypt_remote_file_to_string for Windows remotes#69398
Open
gingeekrishna wants to merge 2 commits into
Open
Fix passphrase quoting in decrypt_remote_file_to_string for Windows remotes#69398gingeekrishna wants to merge 2 commits into
gingeekrishna wants to merge 2 commits into
Conversation
…emotes Single-quoting (Unix shell syntax) does not work on Windows CMD/PowerShell. decrypt_remote_file_to_string used shell_quote_single unconditionally, so any call targeting a Windows remote host produced a malformed openssl command and failed to decrypt. The sibling function decrypt_remote_file in tpt_util.py already handles this correctly by detecting the remote OS via get_remote_os() and using double-quote escaping for Windows. Apply the same pattern here: - Windows: wrap password in double quotes, escape embedded " as "" - Unix/Linux: keep existing single-quote escaping via shell_quote_single Fixes: apache#69396
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.
Motivation
Closes #69396
decrypt_remote_file_to_stringinencryption_utils.pycallsshell_quote_single()unconditionally. Single-quoting is Unix shell syntax and does not work on Windows CMD/PowerShell, so any call targeting a Windows remote host produced a malformedopensslcommand.The issue author notes: "[Note that the decrypt_remote_file function in tpt_util.py does cater for Windows.]" — that function already handles this correctly via
get_remote_os().Changes
Apply the same OS-detection pattern already used in
tpt_util.py:decrypt_remote_file:get_remote_os(ssh_client)"as""shell_quote_single()behaviour (no functional change)Tests
test_decrypt_remote_file_to_stringto mockget_remote_osreturning"unix"(no behaviour change for Unix path)test_decrypt_remote_file_to_string_windowsto assert double-quote escaping is used on Windows remotes, including embedded"characters in the password