[FIX] Don't allow SSH authentication without ssh executable

- Follow up of #4819
- When no `ssh` executable is present, disable the UI and backend bits
that allow the creation of push mirrors that use SSH authentication. As
this feature requires the usage of the `ssh` binary.
- Integration test added.
This commit is contained in:
Gusted 2024-08-26 08:54:16 +02:00
parent a5b51e9145
commit 1a68d14cf8
No known key found for this signature in database
GPG key ID: FD821B732837125F
7 changed files with 80 additions and 0 deletions

View file

@ -38,6 +38,8 @@ var (
InvertedGitFlushEnv bool // 2.43.1
SupportCheckAttrOnBare bool // >= 2.40
HasSSHExecutable bool
gitVersion *version.Version
)
@ -203,6 +205,10 @@ func InitFull(ctx context.Context) (err error) {
globalCommandArgs = append(globalCommandArgs, "-c", "filter.lfs.required=", "-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=")
}
// Detect the presence of the ssh executable in $PATH.
_, err = exec.LookPath("ssh")
HasSSHExecutable = err == nil
return syncGitConfig()
}