Passwords with $!

We use IIQ 8.4 P1.

Upon successful AD account creation, AD post prov rule sends password via email.

if the password has $!, the chars before $! only are sent via email, everything else is getting stripped off when the user receives email,

For example, if generated password is ‘ABC$!kng8YVJv4nw‘, user is getting password as ABC . It appears that $! is causing the issue. Tested with standalone rule and i was able to reproduce the issue.

I can remove $ from the symbols list to make sure that this doesn’t happen again.

If anyone did come across this issue, what did you do to address this issue ?

image
are you using this rule to send passwords to users via email? Could you please share the rule here so we can troubleshoot further?

Instead of using a rule, I suggest using this functionality provided by SailPoint.

This string is expanded and added to the end of the Joiner Temporary Password Notification email sent to inform the manager of the initial, temporary password set for new accounts. If we want we can customize based on our requirement.

Hi @Ramthetrib0

In Velocity, anything that follows a $ symbol is treated as a variable. If the variable has no value, Velocity prints the name as-is (for example, $variableName). To suppress this behavior, you can use the quiet reference syntax $!variableName, which hides the output when the variable is undefined.

Since your generated password contains the sequence $! velocity interprets this as a quiet reference, assuming the characters after ! are the variable name. Since no variable like kng8YVJv4nw exists in the context, velocity replaces it with an empty string, effectively stripping the rest of the password.

As you said, better remove the $ from the password or try to escape with \ or \\.

Thanks,

Sivaprakash.

public static String escapeVelocity(String pass) 
{ 
if (pass == null) return null; 
pass = pass.replace("\\", "\\\\"); 
pass = pass.replace("$", "\\$"); 
pass = pass.replace("#", "\\#"); 
pass = pass.replace("{", "\\{"); 
pass = pass.replace("}", "\\}"); 
pass = pass.replace("$!", "\\$!"); 
return pass; 
}

try to create a method and fix the break before sending the password to email template.

Use escape characters while sending $ or exclamation mark. It will help.

public String escapePasswordForVelocity(String password) {
    if (Util.isNullOrEmpty(password)) {
        return password;
    }
    
    // Order matters: Escape the escape character first
    String escaped = password.replace("\\", "\\\\");
    
    // Escape Velocity specific characters
    escaped = escaped.replace("$", "\\$");
    escaped = escaped.replace("#", "\\#");
    
    return escaped;
}

Try this sample code and make sure to maintain the ordering for proper replacement.

Hi @Ramthetrib0 , You can use the code below to send an email to the user. You need to set the generated password in the emailOptions object: “emailOptions.setVariable(“password”, “ABC$!kng8YVJv4nw”); "If you use a variable, you do not need to escape the characters; it will work with any character. Try the code snippet below.

import java.util.ArrayList;
import java.util.List;

import sailpoint.api.SailPointContext;
import sailpoint.object.EmailOptions;
import sailpoint.object.*;

List emailArray=new ArrayList();
	EmailOptions emailOptions=new EmailOptions();
	emailArray.add("pvr6560@gmail.com");		
	emailOptions.setTo(emailArray);
	emailOptions.setVariable("password", "ABC$!kng8YVJv4nw");
	EmailTemplate emailTemplate=context.getObjectByName(EmailTemplate.class, "LCM Password Change Notification1");
	context.sendEmailNotification(emailTemplate, emailOptions);

refer the password varibale in Email Template :

user will recive below email:

Thanks,

PVR.