Support Paramiko 5 in SSH and SFTP providers#69712
Draft
shivaam wants to merge 1 commit into
Draft
Conversation
Contributor
|
Correct me if I am wrong but from 4->5 this is not a breaking change in terms of Airflow operators right? |
Contributor
Author
It will be breaking for users using sha-1 ssh algorithms. |
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.
Follow-up to #69669.
What
This removes the temporary
paramiko<5.0.0cap from the SSH and SFTP providers and updates the generated dependency tables/lockfile so the providers can resolve Paramiko 5.It also keeps RSA private-key validation working with Paramiko 5 by validating RSA keys with
rsa-sha2-512instead of Paramiko's removed legacyssh-rsaSHA-1 signing path.Why
Paramiko 5 removed legacy SHA-1 SSH behavior, including RSA SHA-1
ssh-rsasigning. Airflow's SSH hook private-key loader was usingkey.sign_ssh_data(b"")as a validation probe, which makes RSA keys fail under Paramiko 5 withKeyError: 'ssh-rsa'.RSA keys are still supported; the issue is only the old SHA-1
ssh-rsaalgorithm. The changelog notes call this out for users whose servers only support legacy SHA-1 SSH algorithms.Validation
uv run python -c 'import inspect, paramiko; print(paramiko.__version__); print(inspect.signature(paramiko.SSHClient.connect)); print(paramiko.RSAKey.HASHES.keys())'uv lock --checkgit diff --checkuv run pytest providers/ssh/tests/unit/ssh/hooks/test_ssh.py -k 'private_key or host_key or dss_host_key or unsupported_host_key' -quv run pytest providers/ssh/tests/unit/ssh/hooks/test_ssh_async.py providers/sftp/tests/unit/sftp/hooks/test_sftp.py -k 'host_key or private_key or connection' -quv run ruff format --check providers/ssh/src/airflow/providers/ssh/hooks/ssh.pyuv run ruff check providers/ssh/src/airflow/providers/ssh/hooks/ssh.pyuv run mypy --config-file pyproject.toml providers/ssh/src/airflow/providers/ssh/hooks/ssh.pyuv run prek --files providers/ssh/src/airflow/providers/ssh/hooks/ssh.py providers/ssh/pyproject.toml providers/ssh/README.rst providers/ssh/docs/index.rst providers/ssh/docs/changelog.rst providers/sftp/pyproject.toml providers/sftp/README.rst providers/sftp/docs/index.rst providers/sftp/docs/changelog.rst uv.lockLocal caveat:
uv run prek mypy-providers --files providers/ssh/src/airflow/providers/ssh/hooks/ssh.pyexits 137 during the local Breeze provider mypy environment setup, without emitting a mypy type error. The direct mypy command above passes.