Skip to content

feat(opencode-plugin): support pinned SSH host keys for noninteractive git sync - #50

Merged
mislavivanda merged 2 commits into
mainfrom
feat/opencode-plugin-ssh-known-hosts
Aug 14, 2026
Merged

feat(opencode-plugin): support pinned SSH host keys for noninteractive git sync#50
mislavivanda merged 2 commits into
mainfrom
feat/opencode-plugin-ssh-known-hosts

Conversation

@mislavivanda

@mislavivanda mislavivanda commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Part of #46 (item: first noninteractive git sync stops at SSH host verification for ssh.app.daytona.io, with no trust path a supervisor can verify without TOFU).

Host verification for sandbox git transfers previously relied entirely on ambient SSH config. On a machine that has never connected to ssh.app.daytona.io, the first push/pull hits an interactive trust-on-first-use prompt — a hard stop for CI and supervised agent runs.

Changes

  • HostGitManager: when DAYTONA_SSH_KNOWN_HOSTS names a known_hosts file, all sandbox git network operations (push/fetch/pull) run with GIT_SSH_COMMAND=ssh -o UserKnownHostsFile=<file> -o StrictHostKeyChecking=yes. Scoped to these git invocations only — SSH behavior for other remotes is untouched. Unset ⇒ behavior unchanged.
  • Path is shell-quoted (GIT_SSH_COMMAND is parsed by sh); quoting round-trip verified for plain paths, spaces, and embedded quotes.
  • README: documents collection (ssh-keyscan) and out-of-band fingerprint verification (ssh-keygen -lf).

Publishing official ssh.app.daytona.io fingerprints in the Daytona docs would complete the story (out of scope for this repo).

Testing

  • tsc --noEmit clean; build covered by CI
  • Shell-quoting round-trip tested for the three quoting classes

Summary by cubic

Pins SSH host verification for sandbox git transfers to enable noninteractive syncs. Previously the first connection prompted TOFU; now, when DAYTONA_SSH_KNOWN_HOSTS points to a known_hosts file, push/fetch/pull run with StrictHostKeyChecking=yes pinned to that file (system known_hosts ignored). Unset leaves behavior unchanged; other remotes are unaffected.

Review and rollout

  • Injects GIT_SSH_COMMAND only in HostGitManager sandbox operations.
  • Uses UserKnownHostsFile="<file>", GlobalKnownHostsFile=/dev/null, and StrictHostKeyChecking=yes.
  • Survives spaced paths via sh single-quoting and OpenSSH double-quoted values; rejects a literal " in the path.
  • Docs cover collecting (ssh-keyscan) and verifying (ssh-keygen -lf) host keys; the configured file is the only host-key database for sandbox transfers.
  • Migration: Create a known_hosts with ssh.app.daytona.io keys and set DAYTONA_SSH_KNOWN_HOSTS. If the file is missing/incorrect or the path contains ", sandbox git operations fail fast.

Written for commit e94f4d9. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/opencode-plugin/.opencode/plugin/daytona/git/host-git-manager.ts Outdated
Comment thread packages/opencode-plugin/.opencode/plugin/daytona/git/host-git-manager.ts Outdated
Comment thread packages/opencode-plugin/README.md
…e git sync

Sandbox git transfers connect to ssh.app.daytona.io, and host verification
previously depended entirely on ambient SSH configuration: on a machine that
had never connected, the first sync stopped at an interactive trust-on-first-
use prompt, which blocks CI and supervised agent runs and offers no way to
verify the host key independently.

Honor DAYTONA_SSH_KNOWN_HOSTS: when it names a known_hosts file containing
the ssh.app.daytona.io host keys, sandbox git transfers run with that exact
file and StrictHostKeyChecking=yes, scoped via GIT_SSH_COMMAND so SSH
behavior for other remotes is untouched. Unset keeps current behavior.

Fixes part of #46

Signed-off-by: Mislav Ivanda <mislavivanda454@gmail.com>
…d survive spaced paths

Review follow-ups on the DAYTONA_SSH_KNOWN_HOSTS support:

- Add GlobalKnownHostsFile=/dev/null so a matching entry in the system-wide
  /etc/ssh/ssh_known_hosts cannot satisfy verification; the configured file
  is now the only host-key database for sandbox transfers.
- Double-quote the UserKnownHostsFile value for OpenSSH's config parser.
  The value crosses two parsers: shell quoting alone still let OpenSSH
  split a spaced path into multiple known_hosts files, which made
  verification fail against the real gateway (reproduced live); the quoted
  form passes. Paths containing a literal double quote are rejected with a
  clear error since OpenSSH's grammar cannot express them.
- README: create the target directory before ssh-keyscan redirect.

Verified against ssh.app.daytona.io: spaced-path known_hosts + the exact
generated GIT_SSH_COMMAND passes host verification and proceeds to the
auth layer.

Signed-off-by: Mislav Ivanda <mislavivanda454@gmail.com>
@mislavivanda
mislavivanda force-pushed the feat/opencode-plugin-ssh-known-hosts branch from 9f084f3 to e94f4d9 Compare August 14, 2026 14:31
@mislavivanda
mislavivanda merged commit 8ebc8f5 into main Aug 14, 2026
33 checks passed
@mislavivanda
mislavivanda deleted the feat/opencode-plugin-ssh-known-hosts branch August 14, 2026 15:06
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant