jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
538 stars 235 forks source link

`curl: (1) Protocol "ssh" not supported or disabled in libcurl` in `jf rt curl -XPOST /api/search/aql` #2115

Open marslojiao-mvl opened 1 year ago

marslojiao-mvl commented 1 year ago

Describe the bug

issue shows in both MacOS 13.5 AND CentOS 8.5

MacOS: curl install via brew

$ sw_vers
ProductName:        macOS
ProductVersion:     13.5
BuildVersion:       22G74

$ uname -a
Darwin localhost 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64 i386 Darwin

$ curl --version
curl 8.2.1 (x86_64-apple-darwin22.4.0) libcurl/8.2.1 (SecureTransport) OpenSSL/3.1.1 zlib/1.2.11 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.55.1 librtmp/2.3 OpenLDAP/2.6.5
Release-Date: 2023-07-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

$ brew info curl
==> curl: stable 8.2.1 (bottled), HEAD [keg-only]
Get a file from an HTTP, HTTPS or FTP server
https://curl.se
/usr/local/Cellar/curl/8.2.1 (514 files, 4.2MB)
  Poured from bottle using the formulae.brew.sh API on 2023-07-27 at 15:26:28
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/curl.rb
License: curl
==> Dependencies
Build: pkg-config ✔
Required: brotli ✔, libidn2 ✔, libnghttp2 ✔, libssh2 ✔, openldap ✘, openssl@3 ✘, rtmpdump ✔, zstd ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have curl first in your PATH, run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> /Users/marslo/.bash_profile

For compilers to find curl you may need to set:
  export LDFLAGS="-L/usr/local/opt/curl/lib"
  export CPPFLAGS="-I/usr/local/opt/curl/include"

For pkg-config to find curl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig"
==> Analytics
install: 91,282 (30 days), 310,371 (90 days), 404,335 (365 days)
install-on-request: 64,572 (30 days), 221,941 (90 days), 287,774 (365 days)
build-error: 16 (30 days)

CentOS: curl install via source

local environment

$ curl --version
curl 8.2.1 (x86_64-pc-linux-gnu) libcurl/8.2.1 OpenSSL/1.1.1k-fips zlib/1.2.11 zstd/1.4.4 libssh2/1.9.0
Release-Date: 2023-07-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS GSS-API HSTS HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

$ which -a curl
    /usr/local/bin/curl           # curl 8.2.1 (x86_64-pc-linux-gnu)
    /usr/bin/curl                 # curl 7.61.1 (x86_64-redhat-linux-gnu)
    /bin/curl

Current behavior

jf c :

$ jf c s artifactory
Server ID:          artifactory
JFrog Platform URL:     ssh://artifactory.example.com:1339/
Artifactory URL:        ssh://artifactory.example.com:1339/
SSH key file path:      ~/.ssh/id_rsa
Default:            true

$ jf rt p
OK

sample.aql

Reproduction steps

AQL:

$ cat sample.aql
items.find ({
  "path" : { "$ne" : "." },
  "$or" : [{
    "$and" : [{
      "repo" : "sampleTools",
      "path" : { "$match": "sampleTools" } ,
      "name" : { "$match": "*" }
    }]
  },
  { "$and" : [{
        "repo" : "sampleTools",
        "path" : { "$match" : "sampleTools/*" } ,
        "name" : { "$match" : "*"}
    }]
  }]
}).include( "name", "repo", "path", "actual_md5", "actual_sha1", "size", "type", "property" )

Expected behavior

same result as curl -XPOST <URL> -T /path/to/aql

JFrog CLI version

jf version 2.44.1

Operating system type and version

CentOS Linux release 8.5.2111 - core-4.1-amd64:core-4.1-noarch ; MacOS 13.5 - root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64 i386 Darwin

JFrog Artifactory version

Enterprise Plus 7.38.10 rev 73810900

JFrog Xray version

No response

pl31 commented 9 months ago

Same issue on Windows Systems, jf Version 2.46.2, installed via winget.

> jf rt curl -XGET /api/v2/security/permissions
curl: (1) Protocol "ssh" not supported or disabled in libcurl
13:12:20 [Error] exit status 1