Skip to content

[BUG] Setting $GIT_SSH_COMMAND is a bad idea #193

@ebarzilay-godaddy

Description

@ebarzilay-godaddy

I originally ran into a very hard to trace issue that resulted from using a newer npm. After much head scratching, I figured out that the problem is that npm is setting $GIT_SSH_COMMAND in a way that kills the script. In my case, the culprit was using a git config setting that sets the ssh command, but $GIT_SSH_COMMAND will override that setting. It's essentially the same problem reported in this comment. This is of course related to #2891, but a different problem. There's more relevant pointers in those issues, and I'll add this commit as the specific one that lead to this problem. (Though it looks like there was always an intention to set it.)

Having gone through a bunch of issues in this neighborhood, I see that this is not the first time that it bites someone. But more than that -- IMO it's actually bad to actually try to do the StrictHostKeyChecking tweaking that this thing is doing. Yes, it can be annoying to figure out the ssh-keyscan that is needed to pre-populate known hosts, but since this is potentially a security issue, I'd argue that disabling it is a BAD idea which should be left for people who want to do that. Even more so in a world where ephemeral runners are common, so you're constantly exposed to the risks that come with the disabling. (The original, plain usage of ssh makes it less dangerous, since you'd get the auto-trusted to happen on the first time you ssh to a new host, but then you'd have that persist. This is why disabling this and using it in an ephemeral runner is a bad idea.)

I therefore think that this particular setting should be removed. Or at least do it based on some setting that is not the default, so it's easier to do the ssh tweaking for people who opt into it (and the docs for that option would be a good place to warn people that it works by setting that env var).

As for the problem of existing things breaking, it shouldn't be too difficult to look at stderr, and if there's a message about an unknown host error, then add some text about the new option (whose page should describe the risk and what could be done to avoid it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions