Most Salesforce sandbox masking tools operate on fields. They scan the schema, find columns tagged as PII, and swap real values for fake ones. That approach works fine for a Contact's email address or an Account's billing phone number. It does nothing for the driver's license photo sitting in a Files record, or the signed contract PDF attached to an Opportunity. Salesforce files and attachments masking is a different problem, and most tools quietly skip it.
The gap matters because files aren't an edge case in most orgs. They're often the richest source of PII in the entire database.
Why field-level masking stops at the database
Masking engines work by querying records, applying a transformation function, and writing the result back. A first name field gets replaced with a name from a synthetic dataset. A national ID number gets replaced with a format-valid fake. This is clean, fast, and deterministic when done right.
Files don't fit that model. A ContentVersion record in Salesforce has metadata fields (file name, owner, created date) that a masking tool can touch, but the actual file content sits as a binary blob, often stored outside the queryable object model entirely. Masking tools built around SOQL and field mapping have no native way to open a PDF, find a name on page three, and replace it.
So the file metadata might get scrubbed while the file itself sails through the sandbox refresh completely intact. The sandbox looks clean at the object level. It isn't clean at all.
What's actually sitting in Files and Attachments2>
Walk through a typical enterprise org and you'll find government ID scans uploaded during KYC checks, signed NDAs with full legal names and signatures, insurance claim forms with policy numbers and medical details, résumés attached to recruiting records, and screenshots of support tickets that happen to show a customer's full invoice. None of that lives in a standard field. All of it lives in a file.
Service Cloud orgs are particularly exposed. Agents routinely attach chat logs, screenshots, and emailed documents directly to cases. Health Cloud and financial services orgs compound the problem with compliance-mandated document uploads: proof of address, bank statements, prescription records. Every one of those documents copies over during a full or partial sandbox refresh unless something intercepts it.
And unlike a text field, a file can contain PII in multiple formats at once: typed text, a scanned image, a signature, even metadata embedded in the file itself (EXIF data on a photo, for instance, can carry GPS coordinates).
Why file content survives a sandbox refresh untouched
Sandbox refresh copies the entire org, including all ContentVersion and Attachment records, by default. Admins can exclude some file storage via sandbox templates in partial copies, but full sandboxes bring everything, and even partial copies frequently include files tied to the records admins chose to include.
Here's the uncomfortable part: because files aren't masked, every sandbox refresh effectively re-exports real customer PII to every environment with sandbox access, every single time. If you refresh weekly, that's 52 fresh exposures a year, each one handing scanned passports and signed contracts to developers, QA testers, and often outsourced contractors who never needed to see them.
I've seen orgs that locked down every sensitive field with textbook masking rules and still had a folder of scanned IDs sitting in Files, fully readable by anyone with sandbox access. The masking project looked complete on paper. It wasn't.
The GDPR exposure this creates
GDPR doesn't distinguish between PII in a field and PII in a file. Article 5's data minimisation principle applies to a scanned passport exactly as it applies to a phone number column. If a sandbox doesn't need the real document, it shouldn't have it. Article 32 requires "appropriate technical measures" to protect personal data, and an unmasked PDF sitting in a dev sandbox with forty engineers' access does not meet that bar.
Supervisory authorities have fined organizations specifically over document-based exposure, not just database leaks. A support agent's screenshot attached to a case, now sitting in three lower environments, is exactly the kind of secondary processing a data subject never consented to. The legal exposure here isn't theoretical; it's the same regulation, just a different data shape.
There's also a practical audit problem. When a regulator or a customer asks "where does our data live," most Salesforce admins can answer for objects and fields. Far fewer can answer for Files, because nobody built a process to track them.
What a real fix actually requires
Closing this gap takes more than running your existing masking rules harder. It requires a different mechanism entirely, built specifically to deal with binary content rather than structured fields.
| Approach | What it does | Limitation |
|---|---|---|
| Exclude files from refresh | Skips ContentVersion/Attachment data entirely during sandbox copy | Breaks dev and QA workflows that depend on realistic file data |
| Delete files post-refresh | Scripted deletion of file records after the sandbox is created | Removes useful test data along with the PII; all-or-nothing |
| Replace with synthetic documents | Swaps real files for generated placeholder documents post-refresh | Needs orchestration tied directly into the refresh pipeline |
| OCR-based redaction | Scans file content, detects PII patterns, redacts in place | Most masking vendors don't offer this at all |
Most organizations default to option one or two because they're the only ones available without custom engineering. Both are blunt instruments. Deleting every file after refresh means your QA team can no longer test document generation, file upload flows, or attachment-related automation, which is a real cost for orgs that depend on Salesforce for contract or claims management.
Building files into the masking process, not around it
MaskEzee treats files and attachments as part of the same masking job that runs against your fields, not a separate manual cleanup step someone forgets. When a sandbox refresh triggers, the masking pass identifies ContentVersion and Attachment records linked to masked objects and applies a defined policy: strip and replace with a synthetic placeholder document, or block the file from copying at the object level entirely, depending on what the environment actually needs.
The policy is set once, per sandbox type. Your QA sandbox might get realistic placeholder PDFs so file-upload automation still has something to test against. Your dev sandbox might simply exclude file bodies altogether, since developers rarely need to open the actual scanned ID to build a trigger. Either way, the real document never reaches an environment that doesn't need it, and the decision isn't left to whoever happens to remember to run a cleanup script after refresh.
This is the part of GDPR-driven masking that gets skipped most often, precisely because it's harder to automate than a field swap. Skipping it doesn't make the risk go away. It just means the exposure sits in a folder instead of a column, waiting for someone to notice during an audit instead of before one.
Frequently Asked Questions
Does standard Salesforce sandbox masking cover file attachments?
No, most masking tools only operate on object fields and leave ContentVersion and Attachment binary content untouched. File metadata like file name or owner might get scrubbed, but the actual document content, including scanned IDs or signed contracts, usually copies over unmasked during a sandbox refresh.
What kinds of PII typically show up in Salesforce Files rather than fields?
Scanned government IDs, signed contracts and NDAs, insurance or medical documents, résumés attached to recruiting records, and support screenshots are common examples. These documents often contain more detailed PII than the structured fields in the same record, because a single file can include a name, address, signature, and ID number all at once.
Does a full sandbox copy include all file attachments by default?
Yes, a full sandbox copies all ContentVersion and Attachment records along with the rest of the org data. Partial copy sandboxes can exclude some records via sandbox templates, but files linked to included records typically still come along, so the exposure isn't fully solved by choosing a smaller sandbox type.
Does GDPR actually apply to files, or just structured database fields?
GDPR applies to personal data regardless of its format, so a scanned passport in a Salesforce file is covered exactly like a phone number in a Contact field. Data minimisation and security obligations under Articles 5 and 32 apply equally, and regulators have issued fines over document-based exposure, not only database leaks.
What's the practical way to stop real documents from reaching lower sandboxes?
The options are excluding files from the refresh, deleting them after refresh via script, or replacing file content with synthetic placeholder documents as part of the masking job itself. The last option is the only one that preserves usable test data without exposing real PII, since it keeps the sandbox functional for file-upload testing without the actual sensitive document.