Use SecretText for sensitive text (LC0043)

Sensitive data such as passwords, API keys, and tokens should be stored in SecretText variables rather than plain Text variables. SecretText provides additional protection by preventing the value from being logged or displayed accidentally.

Example

The following code stores a sensitive value in a plain Text variable:

codeunit 50100 MyCodeunit
{
    procedure Authenticate()
    var
        ApiKey: Text; // Use SecretText for sensitive text [LC0043]
    begin
        ApiKey := GetApiKey();
    end;
}

To fix this, use SecretText for sensitive values:

codeunit 50100 MyCodeunit
{
    procedure Authenticate()
    var
        ApiKey: SecretText;
    begin
        ApiKey := GetApiKey();
    end;
}