Skip to content

Crash when uploading to JFrog Artifactory with SSH public key authentication since version 2.25.1 #1697

@gpwen

Description

@gpwen

Describe the bug

When uploading files to JFrog Artifactory with SSH public key authentication (default server URL was configured as ssh://<server>:<port>) on Windows 10 21H2, using PuTTY Pageant (PuTTY 0.77) as SSH authentication agent:

jf rt u foo.zip repo/and/path/to/upload/

jf.exe crashed with error message: "panic: Failed to find GetCurrentThreadId procedure in user32.dll: The specified procedure could not be found."

Detailed log were attached in Current behavior. The problem happened since version 2.25.1. Versions prior to 2.25.0 (inclusive) worked fine.

Current behavior

jf.exe crashed when uploading files to JFrog Artifactory with SSH public key authentication. The following error log was created with JFrog CLI version 2.26.0 (JFROG_CLI_LOG_LEVEL="DEBUG"):

08:11:33 [Debug] JFrog CLI version: 2.26.0
08:11:33 [Debug] OS/Arch: windows/amd64
08:11:33 [Debug] Usage Report: Sending info...
08:11:33 [Debug] Performing SSH authentication...
08:11:33 [Debug] Trying to authenticate via SSH-Agent...
08:11:33 [Debug] Performing SSH authentication...
08:11:33 [Debug] Trying to authenticate via SSH-Agent...
panic: Failed to find GetCurrentThreadId procedure in user32.dll: The specified procedure could not be found.

goroutine 1 [running]:
golang.org/x/sys/windows.(*LazyProc).mustFind(...)
	/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f/windows/dll_windows.go:325
golang.org/x/sys/windows.(*LazyProc).Call(0xc0002cac60, {0x0, 0x0, 0x0})
	/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f/windows/dll_windows.go:347 +0x65
github.com/xanzy/ssh-agent.winAPI.func1({0x0?, 0x0?, 0x0?})
	/root/go/pkg/mod/github.com/xanzy/ssh-agent@v0.3.2/pageant_windows.go:75 +0x2e
github.com/xanzy/ssh-agent.query({0xc0004982c9, 0x5, 0x2030001?})
	/root/go/pkg/mod/github.com/xanzy/ssh-agent@v0.3.2/pageant_windows.go:100 +0x126
github.com/xanzy/ssh-agent.(*conn).Write(0xc0003ef180, {0xc0004982c9?, 0x5, 0x20?})
	/root/go/pkg/mod/github.com/xanzy/ssh-agent@v0.3.2/sshagent_windows.go:82 +0xe7
golang.org/x/crypto/ssh/agent.(*client).callRaw(0xc0003ae3c0, {0xc0000f1683, 0x1, 0xc0004982c0?})
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/agent/client.go:342 +0x15d
golang.org/x/crypto/ssh/agent.(*client).call(0xc0000f16d8?, {0xc0000f1683?, 0xbd3800?, 0xc000486258?})
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/agent/client.go:321 +0x25
golang.org/x/crypto/ssh/agent.(*client).List(0x97?)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/agent/client.go:403 +0x34
golang.org/x/crypto/ssh/agent.(*client).Signers(0xc0003ae3c0)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/agent/client.go:748 +0x33
golang.org/x/crypto/ssh.publicKeyCallback.auth(0x11?, {0xc00008e040, 0x20, 0x20}, {0xd4feeb, 0x5}, {0xf745c8, 0xc0000ce000}, {0xf6d880, 0x17a63e8}, ...)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/client_auth.go:265 +0x72
golang.org/x/crypto/ssh.(*connection).clientAuthenticate(0xc000098180, 0xc00008c0d0)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/client_auth.go:72 +0x398
golang.org/x/crypto/ssh.(*connection).clientHandshake(0xc000098180, {0xc00002f980, 0x20}, 0xc00008c0d0)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/client.go:113 +0x285
golang.org/x/crypto/ssh.NewClientConn({0xf78290, 0xc00009e008}, {0xc00002f980, 0x20}, 0xc0002ede08)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/client.go:83 +0x12e
golang.org/x/crypto/ssh.Dial({0xd4ae65?, 0xc0003a9416?}, {0xc00002f980, 0x20}, 0xc0002ede08)
	/root/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220817201139-bc19a97f63c8/ssh/client.go:181 +0x59
github.com/jfrog/jfrog-client-go/auth.getSshHeaders({0xf73040?, 0xc0003ae3d8}, {0xc0003a9416, 0x1b}, 0xc0003a9416?)
	/root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.23.3/auth/sshlogin.go:78 +0x193
github.com/jfrog/jfrog-client-go/auth.SshAuthentication({0xc0003a9410?, 0x0?}, {0x0, 0x0}, {0x0, 0x0})
	/root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.23.3/auth/sshlogin.go:31 +0x136
github.com/jfrog/jfrog-client-go/auth.(*CommonConfigFields).AuthenticateSsh(0xc00033c1e0, {0x0?, 0x30000?}, {0x0?, 0x0?})
	/root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.23.3/auth/servicedetails.go:200 +0x8b
github.com/jfrog/jfrog-client-go/auth.(*CommonConfigFields).InitSsh(0xc00033c1e0)
	/root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.23.3/auth/servicedetails.go:214 +0x86
github.com/jfrog/jfrog-client-go/artifactory.NewWithProgress({0xf79258, 0xc0003b4280}, {0x0?, 0x0})
	/root/go/pkg/mod/github.com/jfrog/jfrog-client-go@v1.23.3/artifactory/manager.go:32 +0x6a
github.com/jfrog/jfrog-cli-core/v2/artifactory/utils.CreateServiceManagerWithProgressBar(0xc000404b40, 0x3, 0x3, 0x0, 0x0, {0x0, 0x0})
	/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.21.0/artifactory/utils/utils.go:149 +0x238
github.com/jfrog/jfrog-cli-core/v2/artifactory/utils.CreateUploadServiceManager(...)
	/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.21.0/artifactory/utils/upload.go:10
github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/generic.(*UploadCommand).upload(0xc000367ce0)
	/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.21.0/artifactory/commands/generic/upload.go:91 +0x1c5
github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/generic.(*UploadCommand).Run(0xc0002ee540?)
	/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.21.0/artifactory/commands/generic/upload.go:65 +0x19
github.com/jfrog/jfrog-cli-core/v2/common/commands.Exec({0x1b4534c5a58?, 0xc000367ce0})
	/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/v2@v2.21.0/common/commands/command.go:26 +0xa8
github.com/jfrog/jfrog-cli/utils/progressbar.ExecWithProgress({0xf759d8, 0xc000367ce0})
	/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/utils/progressbar/filesprogressbar.go:332 +0x112
github.com/jfrog/jfrog-cli/artifactory.uploadCmd(0xc00016f1e0)
	/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/artifactory/cli.go:1365 +0x48d
github.com/jfrog/jfrog-cli/artifactory.GetCommands.func1(0xc00016f1e0?)
	/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/artifactory/cli.go:127 +0x19
github.com/urfave/cli.HandleAction({0xbf3ce0?, 0xe1f288?}, 0x6?)
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xd5333a, 0x6}, {0x0, 0x0}, {0xc0001278c0, 0x1, 0x1}, {0xd68401, 0xd}, {0xdff60f, ...}, ...}, ...)
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/command.go:173 +0x652
github.com/urfave/cli.(*App).RunAsSubcommand(0xc000162c40, 0xc00016ef20)
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/app.go:405 +0x927
github.com/urfave/cli.Command.startApp({{0xd4a6f1, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xd83fd7, 0x15}, {0x0, ...}, ...}, ...)
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/command.go:378 +0x6e7
github.com/urfave/cli.Command.Run({{0xd4a6f1, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xd83fd7, 0x15}, {0x0, ...}, ...}, ...)
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/command.go:102 +0x808
github.com/urfave/cli.(*App).Run(0xc000162a80, {0xc000130000, 0x5, 0x8})
	/root/go/pkg/mod/github.com/urfave/cli@v1.22.10/app.go:277 +0x8bb
main.execMain()
	/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:110 +0x349
main.main()
	/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:69 +0x25

Reproduction steps

  1. Config SSH public key authentication on JFrog Artifactory server;

  2. Install PuTTY 0.77, start PuTTY Pageant and load private key;

  3. Configure JFrog CLI to use SSH public key authentication:

    jf config add myserver --interactive=false --url ssh://<server>:<port>
    jf config use myserver
    
  4. Upload file with JFrog CLI, using SSH public key authentication:

    jf rt u foo.zip repo/and/path/to/upload/
    

Expected behavior

The file should be upload correctly.

JFrog CLI version

2.26.0

Operating system type and version

Windows 10 Enterprise 21H2

JFrog Artifactory version

Enterprise Plus 7.38.10

JFrog Xray version

N/A

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions