potiuk commented on code in PR #69908:
URL: https://github.com/apache/airflow/pull/69908#discussion_r3887199457


##########
providers/teradata/tests/unit/teradata/utils/test_encryption_utils.py:
##########
@@ -91,25 +79,42 @@ def test_decrypt_remote_file_to_string(self):
         mock_stdin = MagicMock()
         mock_stdout = MagicMock()
         mock_stderr = MagicMock()
-
-        # Setup mock outputs and exit code
         mock_stdout.channel.recv_exit_status.return_value = 0
         mock_stdout.read.return_value = b"decrypted output"
         mock_stderr.read.return_value = b""
-
         ssh_client.exec_command.return_value = (mock_stdin, mock_stdout, 
mock_stderr)
 
         exit_status, output, err = decrypt_remote_file_to_string(
             ssh_client, remote_enc_file, password, bteq_command_str
         )
 
-        quoted_password = shell_quote_single(password)
         expected_cmd = (
-            f"openssl enc -d -aes-256-cbc -salt -pbkdf2 -pass 
pass:{quoted_password} -in {remote_enc_file} | "
+            f"openssl enc -d -aes-256-cbc -salt -pbkdf2 -pass stdin -in 
{remote_enc_file} | "

Review Comment:
   Non-blocking, but worth closing the loop on: `remote_enc_file` is 
`/remote/encrypted.enc`, which contains no shell-special characters, so 
`shlex.quote()` returns it byte-identical. This assertion therefore passes 
whether or not the source actually applies the quoting — which is exactly how 
it got dropped last time (from my snippet), silently.
   
   Giving the fixture a path with a space makes the test fail the moment the 
quoting disappears:
   
   ```python
   # line 75
   remote_enc_file = "/remote dir/encrypted.enc"
   
   # here
   f"openssl enc -d -aes-256-cbc -salt -pbkdf2 -pass stdin -in 
{shlex.quote(remote_enc_file)} | "
   ```
   
   ---
   Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to