Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): ssh based auth with external key #1208

Merged

Conversation

pascalbreuninger
Copy link
Member

proxy git ssh traffic through our internal client because openssh might not
be installed in the target environment.
If we detect an external SSH key, we pass the GIT_SSH_COMMAND to git,
pointing to the new devpod helper ssh-git-clone command.

@@ -432,7 +432,7 @@ func CloneRepository(ctx context.Context, sshkey string, local bool, workspaceDi

// check if command exists
if !command.Exists("git") {
if local {
if workspaceInfo.Agent.Local == "true" {
Copy link
Contributor

Choose a reason for hiding this comment

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

how is workspaceInfo populated? Do we need to concern ourseleves with nil checking Agent or CLIOptions

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I assume this may be outside the scope of this PR but why is true a string? Does a user set this? If so maybe we should cast to lowercase during the check in case of "True"

Copy link
Member Author

Choose a reason for hiding this comment

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

workspaceInfo is being passed along from the main DevPod binary, we'll error out way earlier if it is nil. As for workspaceInfo.Agent, it's not a pointer so we should be good.

The local option can both be defined by provider authors in provider.yaml and in code which is why it's of type StrBool. We could implement a ToBool method on it to make it safer to check, wyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK makes sense. Yes i think if the value comes from plain text we should either cast to a bool as you say or at least make case insensitive :)

Copy link
Member Author

Choose a reason for hiding this comment

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

added a Bool function to types.StrBool

proxy git ssh traffic through our internal client because openssh might not
be installed in the target environment.
If we detect an external SSH key, we pass the GIT_SSH_COMMAND to git,
pointing to the new `devpod helper ssh-git-clone` command.
@@ -432,7 +432,7 @@ func CloneRepository(ctx context.Context, sshkey string, local bool, workspaceDi

// check if command exists
if !command.Exists("git") {
if local {
if workspaceInfo.Agent.Local == "true" {
Copy link
Contributor

Choose a reason for hiding this comment

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

OK makes sense. Yes i think if the value comes from plain text we should either cast to a bool as you say or at least make case insensitive :)

@pascalbreuninger pascalbreuninger merged commit cb14d18 into loft-sh:main Aug 9, 2024
23 checks passed
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.

2 participants