infamousjoeg / cybr-cli

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @CyberArk suite of products.
Apache License 2.0
72 stars 16 forks source link

When using --self-signed flag, first char of Base URL is truncated #133

Closed infamousjoeg closed 3 years ago

infamousjoeg commented 3 years ago

Describe the bug

ubuntu@ip-10-0-30-39:~/conjur-configurator$ cybr conjur logon -b https://poc-sandbox.joe-garcia.com -l admin -a asurion-poc --self-signed
Enter password:
2021/11/03 17:32:46 Failed to create ~/.conjurrc file. Failed to retrieve certificate from 'oc-sandbox.joe-garcia.com:443'. dial tcp: lookup oc-sandbox.joe-garcia.com: no such host

To Reproduce Steps to reproduce the behavior:

  1. Attempt cybr conjur logon using --self-signed flag.
infamousjoeg commented 3 years ago

We are using strings.TrimLeft("https://") which sets each character as part of a cut set. This means that until any instance of h, t, p, s, :, or / are no longer on the left side, it will continue cutting. This is causing my https://poc-sandbox to cut the p in poc-sandbox, too, since p is part of the cut set.