Skip to content

fix: keep SSH known_hosts temp file alive until repository cleanup#152

Merged
creydr merged 1 commit into
functions-dev:mainfrom
creydr:fix/known-hosts-tempfile-lifecycle
May 20, 2026
Merged

fix: keep SSH known_hosts temp file alive until repository cleanup#152
creydr merged 1 commit into
functions-dev:mainfrom
creydr:fix/known-hosts-tempfile-lifecycle

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented May 20, 2026

Summary

  • The known_hosts temp file created in getSSHClientOptions was immediately deleted via defer before the SSH connection was established in CloneRepository, causing host key verification to silently fail
  • The temp file path is now tracked in Repository.knownHostFile and cleaned up by Cleanup()
  • A defer in CloneRepository ensures cleanup on error paths where no Repository is returned to the caller

The known_hosts temp file was deleted via defer in getSSHClientOptions,
which runs before the SSH connection is established in CloneRepository.
This caused host key verification to fail silently when known_hosts data
was provided.

The temp file is now tracked in Repository.knownHostFile and cleaned up
by Cleanup(). A defer in CloneRepository ensures cleanup on error paths
where no Repository is returned.
@creydr creydr force-pushed the fix/known-hosts-tempfile-lifecycle branch from 64246c1 to 32f8e52 Compare May 20, 2026 11:12
@creydr creydr enabled auto-merge May 20, 2026 11:13
@creydr creydr added this pull request to the merge queue May 20, 2026
Merged via the queue into functions-dev:main with commit e9e8ef9 May 20, 2026
11 checks passed
@creydr creydr deleted the fix/known-hosts-tempfile-lifecycle branch May 20, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant