Skip to main content
Solved

Backward slash in the Beyond trust Password Safe API

  • October 23, 2024
  • 7 replies
  • 141 views

We have stored the secrets in Beyondtrust Password safe and calling those secrets via Beyond trust API. This secret contains the single backward slash and in the Beyond trust API is escaping it by double backwardslash .  This secret is been used for encryption and decryption already the setup /configuration is been done they cannot change the key now. How to handle this?

Best answer by jchandler

Hello Nagapriya,

Generally having a backslash in a password or secret should not cause an issue. 

What is the error and API call you are making?

Also what scripting language are you using when making your API calls?

 

Regards,

John

 

7 replies

  • BeyondTrust Employee
  • Answer
  • October 24, 2024

Hello Nagapriya,

Generally having a backslash in a password or secret should not cause an issue. 

What is the error and API call you are making?

Also what scripting language are you using when making your API calls?

 

Regards,

John

 


  • Author
  • Rising Star
  • October 24, 2024

Hello John,

 

Attached the screenshot from the postman. 

In password safe we are saving the secret with 1 backslash but in api it is showing 3 backslashes.

 

Can you please review this and let me know.


Forum|alt.badge.img+1
  • BeyondTrust Employee
  • October 25, 2024

Hello John,

 

Attached the screenshot from the postman. 

In password safe we are saving the secret with 1 backslash but in api it is showing 3 backslashes.

 

Can you please review this and let me know.

Hello Nagapriya,

The behavior you’re observing is expected. JSON strings represent control characters using escape sequences. The backslash (\) itself is a control character in JSON strings, and it needs to be escaped by another backslash. That’s why, when displaying JSON in Postman or other programs, you see two backslashes (\\) instead of one.

You wish to try changing the “Content-Type” header to something not JSON, and see how you get on with the output.


  • Author
  • Rising Star
  • October 25, 2024

Hi,

 

I tried to change the content-type to Application/Javascript but i am getting the result in Json format itself.

 

 


Forum|alt.badge.img+1
  • BeyondTrust Employee
  • October 25, 2024

Hi,

 

I tried to change the content-type to Application/Javascript but i am getting the result in Json format itself.

 

 

Curious - it may be that the API only gives the data in JSON format, but maybe try:

"Content-Type" = "application/x-www-form-urlencoded"

  • Author
  • Rising Star
  • October 25, 2024

It is still giving the same response with the additional two backward slashes. 


Forum|alt.badge.img+1
  • BeyondTrust Employee
  • October 25, 2024

It is still giving the same response with the additional two backward slashes. 

At this point, it may be worth using something other then Postman to test this - like trying these API calls in PowerShell or even maybe Python. You may get a similar result but you can use addtional programming commands to remove the extra backslashes.