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
71 stars 15 forks source link

Control Character Escaping - ccp get-account #163

Open strick-j opened 2 years ago

strick-j commented 2 years ago

Describe the bug Credentials retrieved via the cybr-cli ccp capability are not escaped properly for use with common tools such as 'jq'. For example when a credential contains a backslash the response contains a single backslash and when you try to parse the response with jq you receive the following error:

echo $test | jq -r '.Content?' parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 5, column 5

If a response contains other special characters such as > the response is escaped properly and is returned as \u003e in place of the >.

cybr ccp get-account -b https://test.test.us -I ServiceTest -s TEST -o appacct-cybrtest { "Address": "STRLAB.US", "CPMStatus": "success", "Content": ":mh(s4lm*PXYqfM\u003e" }

To Reproduce Steps to reproduce the behavior:

  1. Retrieve an account via CCP that contains a \
  2. Use jq to extract the account Content
  3. Error will be displayed

Expected behavior Properly escape control characters when returning response from CCP. Some translation may be necessary from the response received from CyberArk.

Desktop: