potiuk opened a new pull request, #66746: URL: https://github.com/apache/airflow/pull/66746
## Summary Expose paramiko's `MissingHostKeyPolicy` choice as a constructor argument on `ComputeEngineSSHHook`, so callers can opt into strict host-key verification on the SSH transport. The hook previously hard-coded `paramiko.AutoAddPolicy`, which means callers who wanted the remote host authenticated had no way to ask for it. The new `host_key_policy` argument accepts: - the string aliases `"auto_add"`, `"reject"` and `"warning"` — mapped to the matching `paramiko` policy classes; - any custom `paramiko.MissingHostKeyPolicy` instance — so a caller that wants to pin the remote host's key from GCE guest attributes / instance metadata can plug in a policy that loads it on the fly. The default is `"auto_add"`, preserving the historical behaviour of the hook; no migration is required for existing callers. The previous inline comment that claimed the missing host-key check was unrelated to the local private key is removed — it conflated two different concerns — and replaced with a pointer to the new constructor argument. ## Files changed - `providers/google/src/airflow/providers/google/cloud/hooks/compute_ssh.py` — new `host_key_policy` parameter, helper resolver, applied in `_connect_to_instance`. Misleading comment removed. - `providers/google/tests/unit/google/cloud/hooks/test_compute_ssh.py` — new `TestHostKeyPolicyResolution` class (4 cases: default, string aliases, custom instance, unknown-string error). ## Test plan - [ ] `uv run --project providers/google pytest providers/google/tests/unit/google/cloud/hooks/test_compute_ssh.py` — 22 / 22 pass - [ ] `prek run --from-ref upstream/main --stage pre-commit` — clean ## Migration None. Callers that don't pass `host_key_policy` get the same paramiko `AutoAddPolicy` behaviour as before. ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Opus 4.7 (1M context) Generated-by: Claude Opus 4.7 (1M context) following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions -- 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]
