Verbose logging and Private

I have an API Key for a service I am connecting through UiPath. I am storing this API Key as Orchestrator Assets with Text type. I don’t want this API Key getting logged anywhere and thus in my Get Asset activity, I have made it Private.

I also have Verbose logging enabled for Orchestrator logging and when I check the logs, it doesn’t log this API Key as a part of Private: Get Asset Closed log item. This is as expected.

But when I check activity logs of other activities, my API Key simply shows up in plain text. Following is the extract of one such log item.

processVersion: 1.0.3
jobId: b279ec8c-f759-4ab3-82ad-937f428af953
robotName: Adi
machineId: 68703
fileName: Main
keyboard_arrow_down activityInfo: Object
Activity: System.Activities.Statements.Sequence
DisplayName: Sequence
State: Executing
keyboard_arrow_down Variables: Object
testVar: Default Text
another_var: 10
i: 1
finalResult: 0
userName: aditya
apiKey: **<AIP KEY APPEARS HERE IN PLAIN TEXT>**
Arguments: null

The apiKey variable in the log above is a String variable. I tried converting it to SecureString but it fails with error

RemoteException wrapping System.Exception: TypeConverter cannot convert from System.String.

How can I make sure that this API Key doesn’t appear anywhere in my logs?

Hi @adityamooley

Can you show me how you convert it to secure string and how you are adding the secure string to other log records which are in normal string format?

@Lahiru.Fernando

That’s the problem. I am not able to convert it. Getting an exception as I mentioned above.

1 Like

HI @adityamooley

I have a sample workflow which I created some time back to show how to convert a value to secure string and a secure string back to normal string. I think you can make use of it to get some idea around this…

Secure String Sample.xaml (5.9 KB)

Let me know whether this helps you to figure it out… :slight_smile:

@Lahiru.Fernando
Yup. This works.

But my primary question/doubt remains unanswered.

But when I check activity logs of other activities, my API Key simply shows up in plain text. Following is the extract of one such log item.

I expected once a certain variable gets marked as Private in an activity where it is initialized, it will remain Private throughout and its value will not get logged for any other activity as well. But it is not working this way.

@adityamooley

Well what I was trying to say that day was, if you can try to apply that logic I shared with you, using secure string inside a normal string which can mask the exact value in the secure string, I think the same can be use for your log messages as well…

The log message will be in normal string, but for the part where you are mentioning the API key, it can be passed in as a secure string and will be shown as it shows in the sample I shared…

Did you try it out?