Salesforce Shield Platform Encryption and sandbox data masking solve two different problems, and treating them as interchangeable is how orgs end up with real customer PII sitting in a dev sandbox that a dozen contractors can query in plain text. Platform Encryption protects data at rest and in transit in production. It does not stop an authorized sandbox user from viewing real social security numbers, phone numbers, or health data once that data is decrypted for display. If your org's security roadmap lists Shield as the control that covers sandbox exposure, that line item is wrong.
What Platform Encryption Actually Does
Platform Encryption works by encrypting field values at the storage layer using keys your org controls through the Key Management Service. Salesforce supports probabilistic encryption, which produces different ciphertext for the same value each time, and deterministic encryption, which preserves some functionality like exact-match filtering at the cost of weaker protection. Either way, the goal is to protect data from infrastructure-level access: database admins at Salesforce, backup exposure, and certain attack vectors against the underlying storage.
None of that addresses application-level access. Any user with the "View Encrypted Data" permission set, and in many orgs that is most of the internal user base, sees the decrypted value the moment they open a record. Encryption was never designed to hide data from your own employees and contractors. It was designed to hide data from people who should never have gotten to the storage layer in the first place.
That distinction matters enormously once you move into a sandbox context. Sandboxes exist specifically so developers, QA testers, and sometimes outside consultants can poke at records, run debug logs, and build automation against real-looking data. Platform Encryption doesn't restrict that population. It restricts a completely different one.
Why Encrypted Fields Still Leak PII in Sandboxes
When you refresh a sandbox from production, Salesforce copies the encrypted ciphertext along with the encryption key metadata (assuming the org uses the same key management setup, which most do by default). Users with the right permission set open that sandbox and see fully decrypted fields, same as they would in production. The refresh changed nothing about who can read the data. It only changed which org instance holds it.
This is the part that catches security teams off guard. They assume encryption travels with the data as a protective layer that stays locked regardless of environment. In practice, encryption is a storage-level control, and decryption happens at render time based on user permissions, not based on which sandbox the record lives in. A QA contractor with a standard profile and the View Encrypted Data permission set gets the same unmasked SSN in a full sandbox that a support rep sees in production.
Deterministic encryption adds a second wrinkle. Because it preserves equality comparisons, encrypted fields used in formulas, duplicate rules, or list view filters behave closer to plaintext than you'd expect. That's useful for production functionality. It's irrelevant to sandbox exposure and, if anything, makes the encrypted field easier to pattern-match against known values once it's decrypted for viewing.
The Refresh Problem: Encryption Keys and Sandbox Copies
Key management introduces its own complications during a sandbox refresh. Salesforce Shield keys can be scoped per environment, but most orgs don't bother separating sandbox key material from production, partly because managing multiple key sets across a dozen sandboxes is operationally painful. The result: a sandbox refresh inherits the same decryption capability as production, with none of the access restrictions production might have through IP ranges, session policies, or tighter permission assignment.
Admins sometimes assume that disabling encryption in a sandbox, or the fact that a sandbox doesn't have Shield licensed, automatically protects the data. The opposite is true. If Shield isn't active in the sandbox, encrypted production fields get copied over and stored as plain, unencrypted ciphertext-turned-plaintext, often without anyone noticing, because the field still shows the same masked-looking placeholder in the UI until a user with full access opens it.
This is a genuine gap that doesn't get discussed enough: an org can be fully Shield-licensed and properly configured in production, and still have weaker effective protection in a sandbox than in prod, simply because the downstream environment wasn't configured with matching encryption policy. Masking tools that run before or during refresh don't depend on encryption state at all, which is exactly why they close this gap and encryption alone doesn't.
Where Shield and Masking Actually Overlap
There is a legitimate overlap, and it's worth being precise about it instead of pretending the two tools never interact. Shield's Event Monitoring and Field Audit Trail can tell you who accessed what data and when, which is useful forensic evidence after an incident. Masking prevents the incident from being possible in the first place by removing real values before anyone with access can view them.
One practical interaction worth flagging: masking tools that operate on encrypted fields need to run after decryption happens in the data pipeline, or they need API-level access that bypasses standard encryption handling. A masking job that only touches ciphertext without understanding the underlying Shield configuration can either fail silently on encrypted fields or, worse, leave them untouched while masking everything else, creating a false sense of complete coverage.
MaskEzee handles this by reading field-level encryption metadata before the masking pass, so encrypted PII fields get the same fake-data substitution as plaintext fields rather than slipping through because the tool couldn't see past the ciphertext. That's a configuration detail worth confirming with any masking vendor, not an assumption to take on faith.
Data Minimization vs Access Control
GDPR Article 25 asks for privacy by design, and one concrete expression of that principle is data minimization: don't retain or expose more personal data than the task requires. Platform Encryption is an access control. It restricts who can read data, assuming correct permission assignment, but the real personal data still exists in full, in every environment it was copied to.
Masking is a minimization control. It removes the real data and replaces it with synthetic values that preserve format and referential integrity but carry no information about an actual person. A sandbox that's been masked doesn't need encryption to protect the PII in it, because there's no PII left to protect. A sandbox that's only encrypted still contains a full copy of every customer's real data, just gated behind a permission set that sprawling sandbox access tends to erode over time anyway.
I'd argue this is the stronger posture for any regulated org: treat encryption and masking as answering different audit questions. Encryption answers "was the data protected at rest." Masking answers "was real personal data present at all." Regulators and auditors increasingly want the second answer for non-production environments, and encryption alone can't provide it.
Building the Right Stack
The practical answer isn't choosing one tool over the other. It's assigning each to the layer it actually protects. Platform Encryption stays on in production, protecting data at rest against infrastructure-level exposure and satisfying specific compliance requirements around storage security. Masking runs on every sandbox refresh, stripping real PII before any developer, tester, or integration partner gets a connection string into that environment.
Get the sequencing right too. Masking needs to happen as part of the refresh pipeline, not as a manual cleanup step that someone remembers to run a week later. A sandbox sits exposed with real PII for every hour between refresh and masking completion, and that window is exactly when most accidental exposure happens, through a shared sandbox link, a screen share, or an integration test pointed at the wrong org.
- Keep Shield active in production for at-rest and compliance requirements that specifically call for encryption.
- Run masking automatically on every sandbox refresh, full copy or partial, before any user access is granted.
- Confirm your masking tool reads field-level encryption metadata so Shield-protected fields get masked, not skipped.
- Document both controls separately in your compliance evidence. Auditors ask about them as distinct requirements.
None of this requires removing Shield or treating encryption as wasted investment. It requires recognizing that encryption and masking were built to stop different people from seeing data, and a sandbox full of decrypted real PII is still a sandbox full of real PII, Shield license or not.
Frequently Asked Questions
Does Salesforce Shield Platform Encryption protect sandbox data after a refresh?
Not in the way most teams assume. Encryption protects data at rest at the storage layer, but any user with the View Encrypted Data permission set sees fully decrypted values once a sandbox refresh completes. The refresh copies the data and, in most configurations, the ability to decrypt it, so sandbox exposure to internal users stays unchanged by encryption.
Can I skip sandbox masking if my org already uses Platform Encryption?
No. Platform Encryption restricts who can read data based on permissions, while masking removes the real data entirely and replaces it with synthetic values. A sandbox protected only by encryption still contains every customer's actual personal data, which is the exact exposure GDPR and most internal security policies want eliminated from non-production environments.
Do masking tools work correctly on Shield-encrypted fields?
It depends on the tool's configuration. A masking job needs to read field-level encryption metadata to properly process encrypted fields, otherwise it may skip them or fail silently while masking everything else. Before relying on any masking vendor, confirm explicitly that their process accounts for Shield-encrypted fields rather than assuming full coverage.
What happens to encryption keys when a sandbox is refreshed?
Most orgs use the same key management configuration across production and sandboxes, so a refresh typically copies both the encrypted data and the decryption capability together. Unless keys are deliberately scoped per environment, which is uncommon due to the operational overhead, the sandbox ends up with the same effective decryption access as production.
Is encryption or masking the right control for GDPR compliance in sandboxes?
Masking directly addresses GDPR's data minimization principle by removing real personal data from non-production environments entirely. Encryption satisfies different requirements around data-at-rest protection in production. Most compliance programs need both, documented as separate controls answering separate audit questions.