Sub topic 14
Demasking the response for the user
This chapter assumes you know what a prompt is and have read the chapter on masking sensitive data before it leaves Salesforce. Demasking is the reverse step. It restores the original values so the user sees a normal, readable answer.
Why demasking exists
Masking replaces detected values, such as names and email addresses, with placeholders before the prompt goes to the model provider. The model works with those placeholders and often repeats them in its reply. A response that says PERSON_0 reported a problem is safe, but it is not useful to a support agent. Demasking swaps the placeholders back for the real values inside Salesforce, after the response returns.
How it works
The Trust Layer keeps a mapping between each placeholder and its original value for the duration of the request. That mapping stays on the Salesforce side. The model provider never receives it. When the response arrives, the layer looks for placeholders in the text and substitutes the originals.
Response from the LLM:
PERSON_0 reported that her order arrived damaged. Please contact her at EMAIL_0.
Response after demasking (shown to the user):
Maria Lopez reported that her order arrived damaged. Please contact her at [email protected].Where it sits in the flow
Demasking runs after toxicity detection. The response is scored while the sensitive values are still hidden. Then the values are restored. The audit trail records the interaction after that, and the user sees the final text.
As the spine notes, the exact ordering can vary by feature and release. Treat this as the simplified model.
What demasking depends on
Demasking can only restore what masking replaced. This has some practical consequences:
- Values that were never detected were never masked. They went to the model as plain text. In the earlier example, order number
55501was not masked, so nothing needs restoring. - The model may rewrite or drop a placeholder. If it paraphrases
PERSON_0into something else, the layer has nothing to match, and the user sees the model's wording. - Each placeholder maps to one value for that request. Mappings are not shared across requests.
Common errors
| Symptom | Likely cause |
|---|---|
| A placeholder such as `EMAIL_0` appears in the output | The model altered the token, or it appeared where the layer does not substitute |
| A real name is missing from the answer | The model left it out. Demasking does not add values. |
| Sensitive data was visible to the provider | The field type was not covered by the masking configuration |
The third row is a masking problem, not a demasking problem. Review which data types your org masks before assuming the restore step failed.
Exercise
A model response contains "PERSON_0 needs a refund for order 55501." The original prompt masked the customer name but not the order number. What does the user see after demasking, and why is the order number unchanged?
Show answer
The user sees the customer's real name in place of PERSON_0, followed by "needs a refund for order 55501." The order number is unchanged because it was never masked. It reached the model as plain text, so there is no placeholder to restore.