Securely storing passwords and login details with Set Encrypted Text in Katalon Studio

One of the new features for Katalon Studio 5.4 is the ability to store encrypted passwords right inside the test case using the Set Encrypted Text command. Previously, the username and password would be in clear text, so anyone who opened the file could see the login credentials. This now obscures that information while still allowing easy access.

The new command is available while editing the script in Manual mode. Change the normal Set Text command to Set Encrypted text, which brings up a small dialog window that encrypts the text as you type.

set-encrypted-text

With the Item column now changed, double click the input field to bring up the encrypted text dialog box. On this new input screen, click the Value input field and you will be able to type in your text and see the encrypted text. This is what will be saved in the Test Case.

input-encrypted-text

For the login test I have, I check to see which environment the test is running against and then pass the credentials for that environment. By simply changing the Set Text command to Set Encrypted Text, I obscured the username and password in mere moments.

The test now looks like this:

if (GlobalVariable.baseurl == 'https://myqasite.com') {
    //QA credentials
log.logWarning('Logging in to environment - ' + GlobalVariable.baseurl)
    WebUI.setEncryptedText(findTestObject('Page_Sign In/input_UserName'), 'XJ419vj6YqJLWAYDfHAYjLzfymSmyhCi')
    WebUI.setEncryptedText(findTestObject('Page_Sign In/input_Password'), 'e71pytG/LEFOTYb/96yNYh7DOujSLkGz')
} else {
//Staging and Prod credentials
log.logWarning('Logging in to environment - ' + GlobalVariable.baseurl)
    WebUI.setEncryptedText(findTestObject('Page_Sign In/input_UserName'), 'cbbsN3ywIVYTVYg1DVaCdC/EYK/MbMZwGmSPgZHWhNTAx6OdO9Wh9w===')
    WebUI.setEncryptedText(findTestObject('Page_Sign In/input_Password'), 'MihRDM3OZ2lC85FtfophvXwNOqe+xiW4fjG2a5CVrjqCtbHeBRcgvw==')
}
WebUI.click(findTestObject('Page_Sign In/span_Sign in'))

This is a pretty nice feature, and even if you’re just working in a QA or Staging environment, it’s nice to now you can obscure sensitive text from others who might be working on the same project, or from someone who might take a glance at the screen.

Other articles of interest:

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Comments