Skip to content

fix: support ssh auth for git-based skills#1529

Open
jsonmp-k8 wants to merge 1 commit intokagent-dev:mainfrom
jsonmp-k8:fix/1523-git-skills-ssh-auth
Open

fix: support ssh auth for git-based skills#1529
jsonmp-k8 wants to merge 1 commit intokagent-dev:mainfrom
jsonmp-k8:fix/1523-git-skills-ssh-auth

Conversation

@jsonmp-k8
Copy link
Contributor

Summary

  • add openssh-client to the skills-init image so SSH host key discovery is available
  • derive SSH hosts from skill gitRefs and populate known_hosts, including custom ssh:// ports
  • add translator, unit, and golden coverage for SSH-based git skill auth

Testing

  • go test ./core/internal/controller/translator/agent
  • CGO_ENABLED=0 make lint

Fixes #1523

Copilot AI review requested due to automatic review settings March 20, 2026 05:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds SSH-based authentication support for git-backed skills by ensuring ssh-keyscan is available in the skills init image and by populating known_hosts based on SSH git URLs found in an Agent’s gitRefs.

Changes:

  • Install openssh-client in the skills-init image to provide ssh-keyscan.
  • Parse git SSH URLs (including scp-style and ssh:// with custom ports) to derive hosts and generate known_hosts entries during init.
  • Add/extend unit + translator/golden tests to cover SSH host extraction and script generation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/core/internal/controller/translator/agent/adk_api_translator.go Adds SSH host extraction and threads derived hosts into skills-init template data.
go/core/internal/controller/translator/agent/skills-init.sh.tmpl Updates init script to create .ssh with correct perms and ssh-keyscan derived hosts/ports.
docker/skills-init/Dockerfile Installs openssh-client so ssh-keyscan exists at runtime.
go/core/internal/controller/translator/agent/skills_unit_test.go Adds unit coverage for SSH host parsing and SSH host list derivation/sorting.
go/core/internal/controller/translator/agent/git_skills_test.go Extends translator tests to validate SSH script content + secret wiring.
go/core/internal/controller/translator/agent/testdata/outputs/agent_with_git_skills.json Updates golden output to reflect new SSH setup behavior in the rendered script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jsonmp-k8 jsonmp-k8 force-pushed the fix/1523-git-skills-ssh-auth branch from 46d634a to 7ab3dc0 Compare March 20, 2026 05:50
- add openssh-client to the skills-init image
- extract gitSSHHost to derive SSH hosts from skill gitRefs URLs
  (ssh://, git+ssh://, and scp-style), with strict hostname/port
  validation to prevent command injection
- normalize default port 22 to avoid redundant ssh-keyscan -p flag
- gate SSH host collection behind authSecretRef != nil
- add ssh-keyscan failure warning to stderr in init script
- add unit, translator, and golden test coverage

Fixes kagent-dev#1523

Signed-off-by: Jaison Paul <paul.jaison@gmail.com>
@jsonmp-k8 jsonmp-k8 force-pushed the fix/1523-git-skills-ssh-auth branch from 0b4ac10 to 230cdc4 Compare March 20, 2026 06:11
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.

[BUG] git-based skills can't use ssh-based authentication

2 participants