From eab6936dab3edfdea95217d0792d2c87169f04d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 10:01:55 +0000 Subject: [PATCH 1/4] Initial plan From b5e032a51956371c8b56d2271e0959e767ab5812 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 10:09:20 +0000 Subject: [PATCH 2/4] Fix CI host key verification issue in sync_to method Co-authored-by: thorwhalen <1906276+thorwhalen@users.noreply.github.com> --- sshdol/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sshdol/base.py b/sshdol/base.py index 92a6780..eb7bd28 100644 --- a/sshdol/base.py +++ b/sshdol/base.py @@ -771,6 +771,9 @@ def sync_to( ssh_parts = ["ssh", "-p", str(self._conn_port)] if self._conn_key_filename: ssh_parts += ["-i", self._conn_key_filename] + # Add SSH options to handle host key verification + # This is needed for CI environments where host keys may not be in known_hosts + ssh_parts += ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"] ssh_cmd_str = " ".join(shlex.quote(p) for p in ssh_parts) # Build rsync args From b81c7e87a508219425bb15c076c9fa404b4555ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 15:26:40 +0000 Subject: [PATCH 3/4] Replace hardcoded SSH options with environment variable for better security and flexibility Co-authored-by: thorwhalen <1906276+thorwhalen@users.noreply.github.com> --- sshdol/base.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sshdol/base.py b/sshdol/base.py index eb7bd28..beced85 100644 --- a/sshdol/base.py +++ b/sshdol/base.py @@ -771,9 +771,13 @@ def sync_to( ssh_parts = ["ssh", "-p", str(self._conn_port)] if self._conn_key_filename: ssh_parts += ["-i", self._conn_key_filename] - # Add SSH options to handle host key verification - # This is needed for CI environments where host keys may not be in known_hosts - ssh_parts += ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"] + + # Add extra SSH options from environment variable if set + # This allows CI environments or users to specify additional SSH options + extra_ssh_options = os.environ.get('SSHDOL_SYNC_TO_EXTRA_SSH_OPTIONS') + if extra_ssh_options: + # Split the string into individual options, handling quoted arguments properly + ssh_parts += shlex.split(extra_ssh_options) ssh_cmd_str = " ".join(shlex.quote(p) for p in ssh_parts) # Build rsync args From c19d066c63e33d85159e474839a944935d958758 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 15:35:28 +0000 Subject: [PATCH 4/4] Add SSHDOL_SYNC_TO_EXTRA_SSH_OPTIONS environment variable to CI validation job Co-authored-by: thorwhalen <1906276+thorwhalen@users.noreply.github.com> --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5f6198..d021aa8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ jobs: name: Validation if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest + env: + SSHDOL_SYNC_TO_EXTRA_SSH_OPTIONS: "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" strategy: matrix: python-version: ["3.10"]