Sub topic 8
Masking sensitive data before it leaves Salesforce
This chapter assumes you know what grounding is (adding CRM data to a prompt) and that the Trust Layer sits between Salesforce and the model provider. It covers the masking step, which runs after grounding and before the prompt reaches the LLM gateway.
What masking does
Data masking replaces sensitive values in a grounded prompt with placeholder tokens before the prompt leaves Salesforce. The model reasons over the placeholders. It never sees the real values. Demasking later swaps the real values back into the response, so the user sees a normal answer.
The goal is to limit what an external model provider can receive. Grounding is useful because it adds real customer data, and masking reduces the exposure that comes with that.
A worked example
Original grounded prompt (inside Salesforce):
Summarize the case for Maria Lopez ([email protected]).
Her order 55501 arrived damaged.
Prompt after masking (sent to the LLM):
Summarize the case for PERSON_0 (EMAIL_0).
Her order 55501 arrived damaged.
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].Notice that the order number 55501 was not masked. Masking only covers values that detection recognizes and that your configuration includes. The placeholder names and the detected set are illustrative and depend on configuration.
How detection works
Masking relies on detecting sensitive values. Detection uses pattern-based and model-based methods to find categories such as names, email addresses, phone numbers, and similar personal data. Admins choose which categories are masked in Trust Layer settings. Exact categories and options vary by release, so check the current Setup page.
The mapping between placeholders and real values stays on the Salesforce side. That is what makes demasking possible.
Common errors and gotchas
- Assuming everything is masked. Only detected and enabled categories are replaced. Custom identifiers, such as an internal order or account code, may pass through unchanged.
- Free text. Detection is imperfect on unstructured text such as case comments. A misspelled name or an unusual format can be missed.
- Reduced quality. Placeholders remove context. If the task depends on the actual value, such as comparing two names, the output can be weaker.
- Not all features behave the same. Masking support can differ across prompt types and features, so verify it for the one you use.
Checking it yourself
Test with realistic records in a sandbox. Run a prompt that includes names and emails, then review the audit data from the later chapter on the audit trail to see what was sent. This shows you what masking missed in your own data.
Exercise
A prompt includes a customer's name, email, and an internal code "ACCT-7781". After masking, the name and email are replaced by placeholders but "ACCT-7781" is still visible. Is this a malfunction, and what could you do?
Show answer
Not necessarily. Masking only replaces values in detected categories that are enabled. An internal code in a custom format may not be recognized. You can review the masking configuration, check whether the field needs to be in the grounding at all, and remove it from the prompt template if it is sensitive.
Exercise
Where does the mapping between placeholders and original values live, and why does that matter?
Show answer
It stays inside Salesforce. Because the model only sees placeholders, the provider never receives the real values, and Salesforce can still restore them in the response through demasking.